n = int(input())
a = list(map(int, input().split()))

a = sorted(a)

min = a[0]
max = a[n-1]

ans = []

for i in range(1,n-1):
    temp = a[i]
    if(temp < 0):
        ans.append('{} {}'.format(max, temp))
        max -= temp
    else:
        ans.append('{} {}'.format(min, temp))
        min -= temp

ans.append('{} {}'.format(max, min))
max -= min

print(max)

for i in range(n-1):
    print(ans[i]) n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split a = sorted(a) a sorted(a) sorted a min = a[0] min a[0] a 0 max = a[n-1] max a[n-1] a n-1 n 1 ans = [] ans [] for i in range(1,n-1):
    temp = a[i]
    if(temp < 0):
        ans.append('{} {}'.format(max, temp))
        max -= temp
    else:
        ans.append('{} {}'.format(min, temp))
        min -= temp i range(1,n-1) range 1 n-1 n 1 temp = a[i] temp a[i] a i if(temp < 0):
        ans.append('{} {}'.format(max, temp))
        max -= temp
    else:
        ans.append('{} {}'.format(min, temp))
        min -= temp temp < 0 temp 0 ans.append('{} {}'.format(max, temp)) ans.append ans append '{} {}'.format(max, temp) '{} {}'.format '{} {}' format max temp max -= temp max temp ans.append('{} {}'.format(min, temp)) ans.append ans append '{} {}'.format(min, temp) '{} {}'.format '{} {}' format min temp min -= temp min temp ans.append('{} {}'.format(max, min)) ans.append ans append '{} {}'.format(max, min) '{} {}'.format '{} {}' format max min max -= min max min print(max) print max for i in range(n-1):
    print(ans[i]) i range(n-1) range n-1 n 1 print(ans[i]) print ans[i] ans i max = a[n-1] a[n-1] max ans = [] [] ans max -= temp temp max a = list(map(int, input().split())) list(map(int, input().split())) a a = sorted(a) sorted(a) a n = int(input()) int(input()) n min -= temp temp min temp = a[i] a[i] temp max -= min min max min = a[0] a[0] min
n = int(input())
a = list(map(int, input().split()))

a = sorted(a)

min = a[0]
max = a[n-1]

ans = []

for i in range(1,n-1):
    temp = a[i]
    if(temp < 0):
        ans.append('{} {}'.format(max, temp))
        max -= temp
    else:
        ans.append('{} {}'.format(min, temp))
        min -= temp

ans.append('{} {}'.format(max, min))
max -= min

print(max)

for i in range(n-1):
    print(ans[i])
