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

result = []
# all +
if a[0] > 0:
    if len(a) == 2:
        print(a[1]-a[0])
        print(a[1], a[0])
        exit()
    result.append((a[0], a[1]))
    t = a[0]-a[1]
    a.pop(0)
    a[0] = t
# all -
elif a[-1] < 0:
    if len(a) == 2:
        print(a[0]-a[1])
        print(a[0], a[1])
        exit()
    result.append((a[-1], a[-2]))
    t = a[-1]-a[-2]
    a.pop(-1)
    a[-1] = t

# print(a)
b = []
for i in range(len(a)-1):
    if a[i] > 0:
        result.append((b[0], a[i]))
        t = b[0]-a[i]
        b[0] = t
    else:
        b.append(a[i])
b.append(a[-1])
# print(b)
while len(b) != 1:
    result.append((b[-1], b[0]))
    b.append(b[-1]-b[0])
    b.pop(0)
    b.pop(-2)
# print(b)

print(b[0])
for r in result:
    print(r[0],r[1]) N=int(input()) N int(input()) int input() input a = list(sorted(map(int,input().split()))) a list(sorted(map(int,input().split()))) list sorted(map(int,input().split())) sorted map(int,input().split()) map int input().split() ().split () input split result = [] result [] if a[0] > 0:
    if len(a) == 2:
        print(a[1]-a[0])
        print(a[1], a[0])
        exit()
    result.append((a[0], a[1]))
    t = a[0]-a[1]
    a.pop(0)
    a[0] = t
# all -
elif a[-1] < 0:
    if len(a) == 2:
        print(a[0]-a[1])
        print(a[0], a[1])
        exit()
    result.append((a[-1], a[-2]))
    t = a[-1]-a[-2]
    a.pop(-1)
    a[-1] = t

# print(a) a[0] > 0 a[0] a 0 0 if len(a) == 2:
        print(a[1]-a[0])
        print(a[1], a[0])
        exit()
     len(a) == 2 len(a) len a 2 print(a[1]-a[0]) print a[1]-a[0] a[1] a 1 a[0] a 0 print(a[1], a[0]) print a[1] a 1 a[0] a 0 exit() exit result.append((a[0], a[1])) result.append result append (a[0], a[1]) a[0] a 0 a[1] a 1 t = a[0]-a[1] t a[0]-a[1] a[0] a 0 a[1] a 1 a.pop(0) a.pop a pop 0 a[0] = t a[0] a 0 t elif a[-1] < 0:
    if len(a) == 2:
        print(a[0]-a[1])
        print(a[0], a[1])
        exit()
    result.append((a[-1], a[-2]))
    t = a[-1]-a[-2]
    a.pop(-1)
    a[-1] = t

# print(a) a[-1] < 0 a[-1] a -1 0 if len(a) == 2:
        print(a[0]-a[1])
        print(a[0], a[1])
        exit()
     len(a) == 2 len(a) len a 2 print(a[0]-a[1]) print a[0]-a[1] a[0] a 0 a[1] a 1 print(a[0], a[1]) print a[0] a 0 a[1] a 1 exit() exit result.append((a[-1], a[-2])) result.append result append (a[-1], a[-2]) a[-1] a -1 a[-2] a -2 t = a[-1]-a[-2] t a[-1]-a[-2] a[-1] a -1 a[-2] a -2 a.pop(-1) a.pop a pop -1 a[-1] = t a[-1] a -1 t b = [] b [] for i in range(len(a)-1):
    if a[i] > 0:
        result.append((b[0], a[i]))
        t = b[0]-a[i]
        b[0] = t
    else:
        b.append(a[i]) i range(len(a)-1) range len(a)-1 len(a) len a 1 if a[i] > 0:
        result.append((b[0], a[i]))
        t = b[0]-a[i]
        b[0] = t
    else:
        b.append(a[i]) a[i] > 0 a[i] a i 0 result.append((b[0], a[i])) result.append result append (b[0], a[i]) b[0] b 0 a[i] a i t = b[0]-a[i] t b[0]-a[i] b[0] b 0 a[i] a i b[0] = t b[0] b 0 t b.append(a[i]) b.append b append a[i] a i b.append(a[-1]) b.append b append a[-1] a -1 while len(b) != 1:
    result.append((b[-1], b[0]))
    b.append(b[-1]-b[0])
    b.pop(0)
    b.pop(-2)
# print(b) len(b) != 1 len(b) len b 1 result.append((b[-1], b[0])) result.append result append (b[-1], b[0]) b[-1] b -1 b[0] b 0 b.append(b[-1]-b[0]) b.append b append b[-1]-b[0] b[-1] b -1 b[0] b 0 b.pop(0) b.pop b pop 0 b.pop(-2) b.pop b pop -2 print(b[0]) print b[0] b 0 for r in result:
    print(r[0],r[1]) r result print(r[0],r[1]) print r[0] r 0 r[1] r 1 t = a[-1]-a[-2] a[-1]-a[-2] t result = [] [] result t = a[0]-a[1] a[0]-a[1] t N=int(input()) int(input()) N a = list(sorted(map(int,input().split()))) list(sorted(map(int,input().split()))) a b = [] [] b t = b[0]-a[i] b[0]-a[i] t
N=int(input())
a = list(sorted(map(int,input().split())))

result = []
# all +
if a[0] > 0:
    if len(a) == 2:
        print(a[1]-a[0])
        print(a[1], a[0])
        exit()
    result.append((a[0], a[1]))
    t = a[0]-a[1]
    a.pop(0)
    a[0] = t
# all -
elif a[-1] < 0:
    if len(a) == 2:
        print(a[0]-a[1])
        print(a[0], a[1])
        exit()
    result.append((a[-1], a[-2]))
    t = a[-1]-a[-2]
    a.pop(-1)
    a[-1] = t

# print(a)
b = []
for i in range(len(a)-1):
    if a[i] > 0:
        result.append((b[0], a[i]))
        t = b[0]-a[i]
        b[0] = t
    else:
        b.append(a[i])
b.append(a[-1])
# print(b)
while len(b) != 1:
    result.append((b[-1], b[0]))
    b.append(b[-1]-b[0])
    b.pop(0)
    b.pop(-2)
# print(b)

print(b[0])
for r in result:
    print(r[0],r[1])