import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()
f = bisect.bisect_left(a,0)
res = []
if f == 0:
    t = a[0]
    for i in range(1,n-1):
        res.append([t,a[i]])
        t = t - a[i]
    res.append([a[n-1],t])
    t = a[n-1] - t
elif f == n:
    t = a[n-1]
    for i in range(n-1):
        res.append([t,a[i]])
        t = t - a[i]
else:
    t = a[f-1]
    for i in range(f+1,n):
        res.append([t,a[i]])
        t = t - a[i]
    res.append([a[f],t])
    t = a[f] - t
    for i in range(f-1):
        res.append([t,a[i]])
        t = t - a[i]
    

print(t)
for sres in res:
    print(" ".join(map(str, sres))) import bisect bisect 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 f = bisect.bisect_left(a,0) f bisect.bisect_left(a,0) bisect.bisect_left bisect bisect_left a 0 res = [] res [] if f == 0:
    t = a[0]
    for i in range(1,n-1):
        res.append([t,a[i]])
        t = t - a[i]
    res.append([a[n-1],t])
    t = a[n-1] - t
elif f == n:
    t = a[n-1]
    for i in range(n-1):
        res.append([t,a[i]])
        t = t - a[i]
else:
    t = a[f-1]
    for i in range(f+1,n):
        res.append([t,a[i]])
        t = t - a[i]
    res.append([a[f],t])
    t = a[f] - t
    for i in range(f-1):
        res.append([t,a[i]])
        t = t - a[i]
     f == 0 f 0 t = a[0] t a[0] a 0 for i in range(1,n-1):
        res.append([t,a[i]])
        t = t - a[i]
     i range(1,n-1) range 1 n-1 n 1 res.append([t,a[i]]) res.append res append [t,a[i]] t a[i] a i t = t - a[i] t t - a[i] t a[i] a i res.append([a[n-1],t]) res.append res append [a[n-1],t] a[n-1] a n-1 n 1 t t = a[n-1] - t t a[n-1] - t a[n-1] a n-1 n 1 t elif f == n:
    t = a[n-1]
    for i in range(n-1):
        res.append([t,a[i]])
        t = t - a[i] f == n f n t = a[n-1] t a[n-1] a n-1 n 1 for i in range(n-1):
        res.append([t,a[i]])
        t = t - a[i] i range(n-1) range n-1 n 1 res.append([t,a[i]]) res.append res append [t,a[i]] t a[i] a i t = t - a[i] t t - a[i] t a[i] a i t = a[f-1] t a[f-1] a f-1 f 1 for i in range(f+1,n):
        res.append([t,a[i]])
        t = t - a[i]
     i range(f+1,n) range f+1 f 1 n res.append([t,a[i]]) res.append res append [t,a[i]] t a[i] a i t = t - a[i] t t - a[i] t a[i] a i res.append([a[f],t]) res.append res append [a[f],t] a[f] a f t t = a[f] - t t a[f] - t a[f] a f t for i in range(f-1):
        res.append([t,a[i]])
        t = t - a[i]
     i range(f-1) range f-1 f 1 res.append([t,a[i]]) res.append res append [t,a[i]] t a[i] a i t = t - a[i] t t - a[i] t a[i] a i print(t) print t for sres in res:
    print(" ".join(map(str, sres))) sres res print(" ".join(map(str, sres))) print " ".join(map(str, sres)) " ".join " " join map(str, sres) map str sres f = bisect.bisect_left(a,0) bisect.bisect_left(a,0) f res = [] [] res t = t - a[i] t - a[i] t t = a[n-1] - t a[n-1] - t t t = t - a[i] t - a[i] t t = t - a[i] t - a[i] t n=int(input()) int(input()) n t = a[0] a[0] t t = a[f] - t a[f] - t t t = a[f-1] a[f-1] t t = t - a[i] t - a[i] t a=list(map(int,input().split())) list(map(int,input().split())) a t = a[n-1] a[n-1] t
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()
f = bisect.bisect_left(a,0)
res = []
if f == 0:
    t = a[0]
    for i in range(1,n-1):
        res.append([t,a[i]])
        t = t - a[i]
    res.append([a[n-1],t])
    t = a[n-1] - t
elif f == n:
    t = a[n-1]
    for i in range(n-1):
        res.append([t,a[i]])
        t = t - a[i]
else:
    t = a[f-1]
    for i in range(f+1,n):
        res.append([t,a[i]])
        t = t - a[i]
    res.append([a[f],t])
    t = a[f] - t
    for i in range(f-1):
        res.append([t,a[i]])
        t = t - a[i]
    

print(t)
for sres in res:
    print(" ".join(map(str, sres)))