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

a.sort()

u,d,z = 0,0,0
uu,dd = [],[]
for i in range(n):
    if a[i] > 0:
        u += 1
        uu.append(a[i])
    elif a[i] < 0:
        d += 1
        dd.append(a[i])
    else:
        z += 1
        
dd = dd[::-1]
        
ans = []
if u == 0 and d == 0:
    for i in range(z-1):
        ans.append((0,0))
    cur = 0
    
elif d == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(u-1):
            ans.append((cur,uu[i]))
            cur -= uu[i]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
    else:
        cur = uu[0]
        for i in range(u-2):
            ans.append((cur,uu[i+1]))
            cur -= uu[i+1]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
        
elif u == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(d):
            ans.append((cur,dd[i]))
            cur -= dd[i]
    
    else:
        cur = dd[0]
        for i in range(d-1):
            ans.append((cur,dd[i+1]))
            cur -= dd[i+1]
            
else:
    for i in range(z):
        ans.append((uu[0],0))
    cur1 = uu[0]
    cur2 = dd[0]
    for i in range(d-1):
        ans.append((cur1,dd[i+1]))
        cur1 -= dd[i+1]
    for i in range(u-1):
        ans.append((cur2,uu[i+1]))
        cur2 -= uu[i+1]
        
    ans.append((cur1,cur2))
    cur = cur1 - cur2
    
print(cur)
for i in ans:
    print(*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 u,d,z = 0,0,0 u 0 d 0 z 0 uu,dd = [],[] uu [] dd [] for i in range(n):
    if a[i] > 0:
        u += 1
        uu.append(a[i])
    elif a[i] < 0:
        d += 1
        dd.append(a[i])
    else:
        z += 1
         i range(n) range n if a[i] > 0:
        u += 1
        uu.append(a[i])
    elif a[i] < 0:
        d += 1
        dd.append(a[i])
    else:
        z += 1
         a[i] > 0 a[i] a i 0 u += 1 u 1 uu.append(a[i]) uu.append uu append a[i] a i elif a[i] < 0:
        d += 1
        dd.append(a[i])
     a[i] < 0 a[i] a i 0 d += 1 d 1 dd.append(a[i]) dd.append dd append a[i] a i z += 1 z 1 dd = dd[::-1] dd dd[::-1] dd ::-1 -1 ans = [] ans [] if u == 0 and d == 0:
    for i in range(z-1):
        ans.append((0,0))
    cur = 0
    
elif d == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(u-1):
            ans.append((cur,uu[i]))
            cur -= uu[i]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
    else:
        cur = uu[0]
        for i in range(u-2):
            ans.append((cur,uu[i+1]))
            cur -= uu[i+1]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
        
elif u == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(d):
            ans.append((cur,dd[i]))
            cur -= dd[i]
    
    else:
        cur = dd[0]
        for i in range(d-1):
            ans.append((cur,dd[i+1]))
            cur -= dd[i+1]
            
else:
    for i in range(z):
        ans.append((uu[0],0))
    cur1 = uu[0]
    cur2 = dd[0]
    for i in range(d-1):
        ans.append((cur1,dd[i+1]))
        cur1 -= dd[i+1]
    for i in range(u-1):
        ans.append((cur2,uu[i+1]))
        cur2 -= uu[i+1]
        
    ans.append((cur1,cur2))
    cur = cur1 - cur2
     u == 0 and d == 0 u == 0 u 0 d == 0 d 0 for i in range(z-1):
        ans.append((0,0))
     i range(z-1) range z-1 z 1 ans.append((0,0)) ans.append ans append (0,0) 0 0 cur = 0 cur 0 elif d == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(u-1):
            ans.append((cur,uu[i]))
            cur -= uu[i]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
    else:
        cur = uu[0]
        for i in range(u-2):
            ans.append((cur,uu[i+1]))
            cur -= uu[i+1]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
         d == 0 d 0 if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(u-1):
            ans.append((cur,uu[i]))
            cur -= uu[i]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
    else:
        cur = uu[0]
        for i in range(u-2):
            ans.append((cur,uu[i+1]))
            cur -= uu[i+1]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
         z != 0 z 0 for i in range(z-1):
            ans.append((0,0))
         i range(z-1) range z-1 z 1 ans.append((0,0)) ans.append ans append (0,0) 0 0 cur = 0 cur 0 for i in range(u-1):
            ans.append((cur,uu[i]))
            cur -= uu[i]
         i range(u-1) range u-1 u 1 ans.append((cur,uu[i])) ans.append ans append (cur,uu[i]) cur uu[i] uu i cur -= uu[i] cur uu[i] uu i ans.append((uu[u-1],cur)) ans.append ans append (uu[u-1],cur) uu[u-1] uu u-1 u 1 cur cur = uu[u-1] - cur cur uu[u-1] - cur uu[u-1] uu u-1 u 1 cur cur = uu[0] cur uu[0] uu 0 for i in range(u-2):
            ans.append((cur,uu[i+1]))
            cur -= uu[i+1]
         i range(u-2) range u-2 u 2 ans.append((cur,uu[i+1])) ans.append ans append (cur,uu[i+1]) cur uu[i+1] uu i+1 i 1 cur -= uu[i+1] cur uu[i+1] uu i+1 i 1 ans.append((uu[u-1],cur)) ans.append ans append (uu[u-1],cur) uu[u-1] uu u-1 u 1 cur cur = uu[u-1] - cur cur uu[u-1] - cur uu[u-1] uu u-1 u 1 cur elif u == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(d):
            ans.append((cur,dd[i]))
            cur -= dd[i]
    
    else:
        cur = dd[0]
        for i in range(d-1):
            ans.append((cur,dd[i+1]))
            cur -= dd[i+1]
             u == 0 u 0 if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(d):
            ans.append((cur,dd[i]))
            cur -= dd[i]
    
    else:
        cur = dd[0]
        for i in range(d-1):
            ans.append((cur,dd[i+1]))
            cur -= dd[i+1]
             z != 0 z 0 for i in range(z-1):
            ans.append((0,0))
         i range(z-1) range z-1 z 1 ans.append((0,0)) ans.append ans append (0,0) 0 0 cur = 0 cur 0 for i in range(d):
            ans.append((cur,dd[i]))
            cur -= dd[i]
    
     i range(d) range d ans.append((cur,dd[i])) ans.append ans append (cur,dd[i]) cur dd[i] dd i cur -= dd[i] cur dd[i] dd i cur = dd[0] cur dd[0] dd 0 for i in range(d-1):
            ans.append((cur,dd[i+1]))
            cur -= dd[i+1]
             i range(d-1) range d-1 d 1 ans.append((cur,dd[i+1])) ans.append ans append (cur,dd[i+1]) cur dd[i+1] dd i+1 i 1 cur -= dd[i+1] cur dd[i+1] dd i+1 i 1 for i in range(z):
        ans.append((uu[0],0))
     i range(z) range z ans.append((uu[0],0)) ans.append ans append (uu[0],0) uu[0] uu 0 0 cur1 = uu[0] cur1 uu[0] uu 0 cur2 = dd[0] cur2 dd[0] dd 0 for i in range(d-1):
        ans.append((cur1,dd[i+1]))
        cur1 -= dd[i+1]
     i range(d-1) range d-1 d 1 ans.append((cur1,dd[i+1])) ans.append ans append (cur1,dd[i+1]) cur1 dd[i+1] dd i+1 i 1 cur1 -= dd[i+1] cur1 dd[i+1] dd i+1 i 1 for i in range(u-1):
        ans.append((cur2,uu[i+1]))
        cur2 -= uu[i+1]
        
     i range(u-1) range u-1 u 1 ans.append((cur2,uu[i+1])) ans.append ans append (cur2,uu[i+1]) cur2 uu[i+1] uu i+1 i 1 cur2 -= uu[i+1] cur2 uu[i+1] uu i+1 i 1 ans.append((cur1,cur2)) ans.append ans append (cur1,cur2) cur1 cur2 cur = cur1 - cur2 cur cur1 - cur2 cur1 cur2 print(cur) print cur for i in ans:
    print(*i) i ans print(*i) print *i i u,d,z = 0,0,0 0 u cur -= uu[i] uu[i] cur uu,dd = [],[] [] uu cur = 0 0 cur n = int(input()) int(input()) n d += 1 1 d cur = uu[0] uu[0] cur u += 1 1 u cur = dd[0] dd[0] cur cur -= uu[i+1] uu[i+1] cur dd = [],[] [] dd z += 1 1 z cur1 -= dd[i+1] dd[i+1] cur1 cur2 = dd[0] dd[0] cur2 cur2 -= uu[i+1] uu[i+1] cur2 cur -= dd[i+1] dd[i+1] cur d,z = 0,0,0 0 d z = 0,0,0 0 z cur = cur1 - cur2 cur1 - cur2 cur cur -= dd[i] dd[i] cur a = list(map(int,input().split())) list(map(int,input().split())) a cur = uu[u-1] - cur uu[u-1] - cur cur cur = 0 0 cur cur = uu[u-1] - cur uu[u-1] - cur cur cur = 0 0 cur dd = dd[::-1] dd[::-1] dd ans = [] [] ans cur1 = uu[0] uu[0] cur1
n = int(input())
a = list(map(int,input().split()))

a.sort()

u,d,z = 0,0,0
uu,dd = [],[]
for i in range(n):
    if a[i] > 0:
        u += 1
        uu.append(a[i])
    elif a[i] < 0:
        d += 1
        dd.append(a[i])
    else:
        z += 1
        
dd = dd[::-1]
        
ans = []
if u == 0 and d == 0:
    for i in range(z-1):
        ans.append((0,0))
    cur = 0
    
elif d == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(u-1):
            ans.append((cur,uu[i]))
            cur -= uu[i]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
    else:
        cur = uu[0]
        for i in range(u-2):
            ans.append((cur,uu[i+1]))
            cur -= uu[i+1]
        ans.append((uu[u-1],cur))
        cur = uu[u-1] - cur
        
elif u == 0:
    if z != 0:
        for i in range(z-1):
            ans.append((0,0))
        cur = 0
        for i in range(d):
            ans.append((cur,dd[i]))
            cur -= dd[i]
    
    else:
        cur = dd[0]
        for i in range(d-1):
            ans.append((cur,dd[i+1]))
            cur -= dd[i+1]
            
else:
    for i in range(z):
        ans.append((uu[0],0))
    cur1 = uu[0]
    cur2 = dd[0]
    for i in range(d-1):
        ans.append((cur1,dd[i+1]))
        cur1 -= dd[i+1]
    for i in range(u-1):
        ans.append((cur2,uu[i+1]))
        cur2 -= uu[i+1]
        
    ans.append((cur1,cur2))
    cur = cur1 - cur2
    
print(cur)
for i in ans:
    print(*i)