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

a.sort()

now = 0

ans = []

for i in range(n-2):
    if a[i+1] > 0:
        ans.append([a[0], a[i+1]])
        a[0] = a[0] - a[i+1]
    else:
        ans.append([a[n-1], a[i+1]])
        a[n-1] = a[n-1] - a[i+1]

ans.append([a[n-1],a[0]])
print(a[n-1]-a[0])

for i in ans:
    print(i[0],i[1]) 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.sort() a.sort a sort now = 0 now 0 ans = [] ans [] for i in range(n-2):
    if a[i+1] > 0:
        ans.append([a[0], a[i+1]])
        a[0] = a[0] - a[i+1]
    else:
        ans.append([a[n-1], a[i+1]])
        a[n-1] = a[n-1] - a[i+1] i range(n-2) range n-2 n 2 if a[i+1] > 0:
        ans.append([a[0], a[i+1]])
        a[0] = a[0] - a[i+1]
    else:
        ans.append([a[n-1], a[i+1]])
        a[n-1] = a[n-1] - a[i+1] a[i+1] > 0 a[i+1] a i+1 i 1 0 ans.append([a[0], a[i+1]]) ans.append ans append [a[0], a[i+1]] a[0] a 0 a[i+1] a i+1 i 1 a[0] = a[0] - a[i+1] a[0] a 0 a[0] - a[i+1] a[0] a 0 a[i+1] a i+1 i 1 ans.append([a[n-1], a[i+1]]) ans.append ans append [a[n-1], a[i+1]] a[n-1] a n-1 n 1 a[i+1] a i+1 i 1 a[n-1] = a[n-1] - a[i+1] a[n-1] a n-1 n 1 a[n-1] - a[i+1] a[n-1] a n-1 n 1 a[i+1] a i+1 i 1 ans.append([a[n-1],a[0]]) ans.append ans append [a[n-1],a[0]] a[n-1] a n-1 n 1 a[0] a 0 print(a[n-1]-a[0]) print a[n-1]-a[0] a[n-1] a n-1 n 1 a[0] a 0 for i in ans:
    print(i[0],i[1]) i ans print(i[0],i[1]) print i[0] i 0 i[1] i 1 a = list(map(int, input().split())) list(map(int, input().split())) a n = int(input()) int(input()) n ans = [] [] ans now = 0 0 now
n = int(input())
a = list(map(int, input().split()))

a.sort()

now = 0

ans = []

for i in range(n-2):
    if a[i+1] > 0:
        ans.append([a[0], a[i+1]])
        a[0] = a[0] - a[i+1]
    else:
        ans.append([a[n-1], a[i+1]])
        a[n-1] = a[n-1] - a[i+1]

ans.append([a[n-1],a[0]])
print(a[n-1]-a[0])

for i in ans:
    print(i[0],i[1])