from bisect import bisect_left as bi
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
b,num = bi(a,0),a[0]
if b==n:
    q = n-1
    print(a[-1]-sum(a[:n-1]))
elif b:
    q = b
    print(sum(a[b:])-sum(a[:b]))
else:
    q = 1
    print(sum(a[1:])-a[0])
for i in range(q,n-1):
    print(num,a[i])
    num-=a[i]
print(a[-1],num)
num = a[-1]-num
for i in range(1,q):
    print(num,a[i])
    num-=a[i] from bisect import bisect_left as bi n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a = [int(i) for i in input().split()] a [int(i) for i in input().split()] a = sorted(a) a sorted(a) sorted a b,num = bi(a,0),a[0] b bi(a,0) bi a 0 num a[0] a 0 if b==n:
    q = n-1
    print(a[-1]-sum(a[:n-1]))
elif b:
    q = b
    print(sum(a[b:])-sum(a[:b]))
else:
    q = 1
    print(sum(a[1:])-a[0]) b==n b n q = n-1 q n-1 n 1 print(a[-1]-sum(a[:n-1])) print a[-1]-sum(a[:n-1]) a[-1] a -1 sum(a[:n-1]) sum a[:n-1] a :n-1 n-1 n 1 elif b:
    q = b
    print(sum(a[b:])-sum(a[:b])) b q = b q b print(sum(a[b:])-sum(a[:b])) print sum(a[b:])-sum(a[:b]) sum(a[b:]) sum a[b:] a b: b sum(a[:b]) sum a[:b] a :b b q = 1 q 1 print(sum(a[1:])-a[0]) print sum(a[1:])-a[0] sum(a[1:]) sum a[1:] a 1: 1 a[0] a 0 for i in range(q,n-1):
    print(num,a[i])
    num-=a[i] i range(q,n-1) range q n-1 n 1 print(num,a[i]) print num a[i] a i num-=a[i] num a[i] a i print(a[-1],num) print a[-1] a -1 num num = a[-1]-num num a[-1]-num a[-1] a -1 num for i in range(1,q):
    print(num,a[i])
    num-=a[i] i range(1,q) range 1 q print(num,a[i]) print num a[i] a i num-=a[i] num a[i] a i num = bi(a,0),a[0] a[0] num num = a[-1]-num a[-1]-num num a = sorted(a) sorted(a) a q = b b q q = 1 1 q num-=a[i] a[i] num b,num = bi(a,0),a[0] bi(a,0) b q = n-1 n-1 q num-=a[i] a[i] num a = [int(i) for i in input().split()] [int(i) for i in input().split()] a n = int(input()) int(input()) n
from bisect import bisect_left as bi
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
b,num = bi(a,0),a[0]
if b==n:
    q = n-1
    print(a[-1]-sum(a[:n-1]))
elif b:
    q = b
    print(sum(a[b:])-sum(a[:b]))
else:
    q = 1
    print(sum(a[1:])-a[0])
for i in range(q,n-1):
    print(num,a[i])
    num-=a[i]
print(a[-1],num)
num = a[-1]-num
for i in range(1,q):
    print(num,a[i])
    num-=a[i]