
N = int(input())

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

#%%

A.sort()

keyz = 0
for a in A:
    if a<0:
        keyz += 1

if keyz==0:
    keyz = 1
elif keyz == N:
    keyz = N-1


M = 0
M += -sum(A[:keyz])
M += sum(A[keyz:])
print(M)

# A[0:keyz]までを負とする
    

# A[keyz:]は反転させる必要あり

if keyz == N-1:
    cur = A[-1]
    for i in range(N-1):
        print(cur,A[i])
        cur -= A[i]
    
else:            
    cur = A[0]
    for i in range(keyz,N-1):
        print(cur,A[i])
        cur = cur - A[i]
    print(A[N-1],cur)
    cur = A[N-1] - cur
    for i in range(1,keyz):
        print(cur,A[i])
        cur -= A[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.sort() A.sort A sort keyz = 0 keyz 0 for a in A:
    if a<0:
        keyz += 1 a A if a<0:
        keyz += 1 a<0 a 0 keyz += 1 keyz 1 if keyz==0:
    keyz = 1
elif keyz == N:
    keyz = N-1 keyz==0 keyz 0 keyz = 1 keyz 1 elif keyz == N:
    keyz = N-1 keyz == N keyz N keyz = N-1 keyz N-1 N 1 M = 0 M 0 M += -sum(A[:keyz]) M -sum(A[:keyz]) sum(A[:keyz]) sum A[:keyz] A :keyz keyz M += sum(A[keyz:]) M sum(A[keyz:]) sum A[keyz:] A keyz: keyz print(M) print M if keyz == N-1:
    cur = A[-1]
    for i in range(N-1):
        print(cur,A[i])
        cur -= A[i]
    
else:            
    cur = A[0]
    for i in range(keyz,N-1):
        print(cur,A[i])
        cur = cur - A[i]
    print(A[N-1],cur)
    cur = A[N-1] - cur
    for i in range(1,keyz):
        print(cur,A[i])
        cur -= A[i]
        
         keyz == N-1 keyz N-1 N 1 cur = A[-1] cur A[-1] A -1 for i in range(N-1):
        print(cur,A[i])
        cur -= A[i]
     i range(N-1) range N-1 N 1 print(cur,A[i]) print cur A[i] A i cur -= A[i] cur A[i] A i cur = A[0] cur A[0] A 0 for i in range(keyz,N-1):
        print(cur,A[i])
        cur = cur - A[i]
     i range(keyz,N-1) range keyz N-1 N 1 print(cur,A[i]) print cur A[i] A i cur = cur - A[i] cur cur - A[i] cur A[i] A i print(A[N-1],cur) print A[N-1] A N-1 N 1 cur cur = A[N-1] - cur cur A[N-1] - cur A[N-1] A N-1 N 1 cur for i in range(1,keyz):
        print(cur,A[i])
        cur -= A[i]
        
         i range(1,keyz) range 1 keyz print(cur,A[i]) print cur A[i] A i cur -= A[i] cur A[i] A i keyz = N-1 N-1 keyz cur -= A[i] A[i] cur M += sum(A[keyz:]) sum(A[keyz:]) M cur -= A[i] A[i] cur keyz = 1 1 keyz N = int(input()) int(input()) N cur = A[N-1] - cur A[N-1] - cur cur cur = cur - A[i] cur - A[i] cur keyz = 0 0 keyz M += -sum(A[:keyz]) -sum(A[:keyz]) M keyz += 1 1 keyz cur = A[0] A[0] cur cur = A[-1] A[-1] cur A = list(map(int,input().split())) list(map(int,input().split())) A M = 0 0 M

N = int(input())

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

#%%

A.sort()

keyz = 0
for a in A:
    if a<0:
        keyz += 1

if keyz==0:
    keyz = 1
elif keyz == N:
    keyz = N-1


M = 0
M += -sum(A[:keyz])
M += sum(A[keyz:])
print(M)

# A[0:keyz]までを負とする
    

# A[keyz:]は反転させる必要あり

if keyz == N-1:
    cur = A[-1]
    for i in range(N-1):
        print(cur,A[i])
        cur -= A[i]
    
else:            
    cur = A[0]
    for i in range(keyz,N-1):
        print(cur,A[i])
        cur = cur - A[i]
    print(A[N-1],cur)
    cur = A[N-1] - cur
    for i in range(1,keyz):
        print(cur,A[i])
        cur -= A[i]
        
        



