from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort(reverse=True)
plus = []
minus = []
lin = []
for i in li:
    if i < 0:
        minus.append(i)
    else:
        plus.append(i)
if not plus:
    x = minus[0]
    for i in range(1,n):
        y = minus[i]
        lin.append([x,y])
        x -= y
    print(x)
    for i in lin:
        print(*i)
elif not minus:
    x = plus[-1]
    for i in range(1,n-1):
        y = plus[i]
        lin.append([x,y])
        x -= y
    lin.append([plus[0],x])
    print(plus[0]-x)
    for i in lin:
        print(*i)
else:
    x = minus[-1]
    y = plus[0]
    for i in range(len(minus)-1):
        lin.append([y,minus[i]])
        y -= minus[i]
    for i in range(1,len(plus)):
        lin.append([x,plus[i]])
        x -= plus[i]
    lin.append([y,x])
    print(y-x)
    for i in lin:
        print(*i) from sys import stdin n = int(stdin.readline().rstrip()) n int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip li = list(map(int,stdin.readline().rstrip().split())) li list(map(int,stdin.readline().rstrip().split())) list map(int,stdin.readline().rstrip().split()) map int stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split li.sort(reverse=True) li.sort li sort reverse=True reverse True plus = [] plus [] minus = [] minus [] lin = [] lin [] for i in li:
    if i < 0:
        minus.append(i)
    else:
        plus.append(i) i li if i < 0:
        minus.append(i)
    else:
        plus.append(i) i < 0 i 0 minus.append(i) minus.append minus append i plus.append(i) plus.append plus append i if not plus:
    x = minus[0]
    for i in range(1,n):
        y = minus[i]
        lin.append([x,y])
        x -= y
    print(x)
    for i in lin:
        print(*i)
elif not minus:
    x = plus[-1]
    for i in range(1,n-1):
        y = plus[i]
        lin.append([x,y])
        x -= y
    lin.append([plus[0],x])
    print(plus[0]-x)
    for i in lin:
        print(*i)
else:
    x = minus[-1]
    y = plus[0]
    for i in range(len(minus)-1):
        lin.append([y,minus[i]])
        y -= minus[i]
    for i in range(1,len(plus)):
        lin.append([x,plus[i]])
        x -= plus[i]
    lin.append([y,x])
    print(y-x)
    for i in lin:
        print(*i) not plus plus x = minus[0] x minus[0] minus 0 for i in range(1,n):
        y = minus[i]
        lin.append([x,y])
        x -= y
     i range(1,n) range 1 n y = minus[i] y minus[i] minus i lin.append([x,y]) lin.append lin append [x,y] x y x -= y x y print(x) print x for i in lin:
        print(*i) i lin print(*i) print *i i elif not minus:
    x = plus[-1]
    for i in range(1,n-1):
        y = plus[i]
        lin.append([x,y])
        x -= y
    lin.append([plus[0],x])
    print(plus[0]-x)
    for i in lin:
        print(*i) not minus minus x = plus[-1] x plus[-1] plus -1 for i in range(1,n-1):
        y = plus[i]
        lin.append([x,y])
        x -= y
     i range(1,n-1) range 1 n-1 n 1 y = plus[i] y plus[i] plus i lin.append([x,y]) lin.append lin append [x,y] x y x -= y x y lin.append([plus[0],x]) lin.append lin append [plus[0],x] plus[0] plus 0 x print(plus[0]-x) print plus[0]-x plus[0] plus 0 x for i in lin:
        print(*i) i lin print(*i) print *i i x = minus[-1] x minus[-1] minus -1 y = plus[0] y plus[0] plus 0 for i in range(len(minus)-1):
        lin.append([y,minus[i]])
        y -= minus[i]
     i range(len(minus)-1) range len(minus)-1 len(minus) len minus 1 lin.append([y,minus[i]]) lin.append lin append [y,minus[i]] y minus[i] minus i y -= minus[i] y minus[i] minus i for i in range(1,len(plus)):
        lin.append([x,plus[i]])
        x -= plus[i]
     i range(1,len(plus)) range 1 len(plus) len plus lin.append([x,plus[i]]) lin.append lin append [x,plus[i]] x plus[i] plus i x -= plus[i] x plus[i] plus i lin.append([y,x]) lin.append lin append [y,x] y x print(y-x) print y-x y x for i in lin:
        print(*i) i lin print(*i) print *i i minus = [] [] minus plus = [] [] plus x -= y y x x = minus[0] minus[0] x y = plus[i] plus[i] y lin = [] [] lin x = minus[-1] minus[-1] x x -= plus[i] plus[i] x y -= minus[i] minus[i] y li = list(map(int,stdin.readline().rstrip().split())) list(map(int,stdin.readline().rstrip().split())) li y = minus[i] minus[i] y y = plus[0] plus[0] y x -= y y x n = int(stdin.readline().rstrip()) int(stdin.readline().rstrip()) n x = plus[-1] plus[-1] x
from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort(reverse=True)
plus = []
minus = []
lin = []
for i in li:
    if i < 0:
        minus.append(i)
    else:
        plus.append(i)
if not plus:
    x = minus[0]
    for i in range(1,n):
        y = minus[i]
        lin.append([x,y])
        x -= y
    print(x)
    for i in lin:
        print(*i)
elif not minus:
    x = plus[-1]
    for i in range(1,n-1):
        y = plus[i]
        lin.append([x,y])
        x -= y
    lin.append([plus[0],x])
    print(plus[0]-x)
    for i in lin:
        print(*i)
else:
    x = minus[-1]
    y = plus[0]
    for i in range(len(minus)-1):
        lin.append([y,minus[i]])
        y -= minus[i]
    for i in range(1,len(plus)):
        lin.append([x,plus[i]])
        x -= plus[i]
    lin.append([y,x])
    print(y-x)
    for i in lin:
        print(*i)