N = int(input())
a = sorted(list(map(int, input().split())))
nyu = []
ma = a[-1]
mi = a[0]
i=0
while i!=N-2:
    if a[i+1]>=0:
        nyu.append([mi, a[i+1]])
        mi -= a[i+1]
    else:
        nyu.append([ma, a[i+1]])
        ma -= a[i+1]
    i += 1
nyu.append([ma, mi])
print(nyu[N-2][0]-nyu[N-2][1])
for i in range(N-1):
    print(nyu[i][0], nyu[i][1]) N = int(input()) N int(input()) int input() input a = sorted(list(map(int, input().split()))) a sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split nyu = [] nyu [] ma = a[-1] ma a[-1] a -1 mi = a[0] mi a[0] a 0 i=0 i 0 while i!=N-2:
    if a[i+1]>=0:
        nyu.append([mi, a[i+1]])
        mi -= a[i+1]
    else:
        nyu.append([ma, a[i+1]])
        ma -= a[i+1]
    i += 1 i!=N-2 i N-2 N 2 if a[i+1]>=0:
        nyu.append([mi, a[i+1]])
        mi -= a[i+1]
    else:
        nyu.append([ma, a[i+1]])
        ma -= a[i+1]
     a[i+1]>=0 a[i+1] a i+1 i 1 0 nyu.append([mi, a[i+1]]) nyu.append nyu append [mi, a[i+1]] mi a[i+1] a i+1 i 1 mi -= a[i+1] mi a[i+1] a i+1 i 1 nyu.append([ma, a[i+1]]) nyu.append nyu append [ma, a[i+1]] ma a[i+1] a i+1 i 1 ma -= a[i+1] ma a[i+1] a i+1 i 1 i += 1 i 1 nyu.append([ma, mi]) nyu.append nyu append [ma, mi] ma mi print(nyu[N-2][0]-nyu[N-2][1]) print nyu[N-2][0]-nyu[N-2][1] nyu[N-2][0] [N-2] nyu N-2 N 2 0 nyu[N-2][1] [N-2] nyu N-2 N 2 1 for i in range(N-1):
    print(nyu[i][0], nyu[i][1]) i range(N-1) range N-1 N 1 print(nyu[i][0], nyu[i][1]) print nyu[i][0] [i] nyu i 0 nyu[i][1] [i] nyu i 1 i=0 0 i mi -= a[i+1] a[i+1] mi i += 1 1 i ma -= a[i+1] a[i+1] ma N = int(input()) int(input()) N ma = a[-1] a[-1] ma a = sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) a nyu = [] [] nyu mi = a[0] a[0] mi
N = int(input())
a = sorted(list(map(int, input().split())))
nyu = []
ma = a[-1]
mi = a[0]
i=0
while i!=N-2:
    if a[i+1]>=0:
        nyu.append([mi, a[i+1]])
        mi -= a[i+1]
    else:
        nyu.append([ma, a[i+1]])
        ma -= a[i+1]
    i += 1
nyu.append([ma, mi])
print(nyu[N-2][0]-nyu[N-2][1])
for i in range(N-1):
    print(nyu[i][0], nyu[i][1])