n=int(input())

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

a.sort()

query = []

high = a[-1]

low = a[0]

for i in range(1,n-1):
    if a[i] > 0:
        query.append([low, a[i]])
        low -= a[i]
    else:
        query.append([high, a[i]])
        high -= a[i]

query.append([high, low])

print(high-low)

for x,y in query:
    print(x,y)
 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 query = [] query [] high = a[-1] high a[-1] a -1 low = a[0] low a[0] a 0 for i in range(1,n-1):
    if a[i] > 0:
        query.append([low, a[i]])
        low -= a[i]
    else:
        query.append([high, a[i]])
        high -= a[i] i range(1,n-1) range 1 n-1 n 1 if a[i] > 0:
        query.append([low, a[i]])
        low -= a[i]
    else:
        query.append([high, a[i]])
        high -= a[i] a[i] > 0 a[i] a i 0 query.append([low, a[i]]) query.append query append [low, a[i]] low a[i] a i low -= a[i] low a[i] a i query.append([high, a[i]]) query.append query append [high, a[i]] high a[i] a i high -= a[i] high a[i] a i query.append([high, low]) query.append query append [high, low] high low print(high-low) print high-low high low for x,y in query:
    print(x,y) x y query print(x,y) print x y a = list(map(int,input().split())) list(map(int,input().split())) a low -= a[i] a[i] low high -= a[i] a[i] high high = a[-1] a[-1] high n=int(input()) int(input()) n low = a[0] a[0] low query = [] [] query
n=int(input())

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

a.sort()

query = []

high = a[-1]

low = a[0]

for i in range(1,n-1):
    if a[i] > 0:
        query.append([low, a[i]])
        low -= a[i]
    else:
        query.append([high, a[i]])
        high -= a[i]

query.append([high, low])

print(high-low)

for x,y in query:
    print(x,y)

