n = int(input())
al = list(map(int, input().split()))
al.sort()

if n==2:
    print(al[1]-al[0])
    print(al[1],al[0])
    exit()

res = []
neg = []
pos = []
for a in al:
    if a>=0:
        pos.append(a)
    else:
        neg.append(a)

if len(pos)==0:
    res.append((neg[-1],neg[-2]))
    pos.append(neg[-1]-neg[-2])
    neg = neg[:-2]
if len(neg)==0:
    res.append((pos[0],pos[1]))
    neg.append(pos[0]-pos[1])
    pos = pos[2:]


# len(pos)>0 and len(neg)>0
n = neg[0]
for i in range(1,len(pos)):
    res.append((n,pos[i]))
    n = n - pos[i]
p = pos[0]
for i in range(1,len(neg)):
    res.append((p,neg[i]))
    p = p - neg[i]
res.append((p,n))
print(p-n)
for x,y in res:
    print(x,y) n = int(input()) n int(input()) int input() input al = list(map(int, input().split())) al list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split al.sort() al.sort al sort if n==2:
    print(al[1]-al[0])
    print(al[1],al[0])
    exit() n==2 n 2 print(al[1]-al[0]) print al[1]-al[0] al[1] al 1 al[0] al 0 print(al[1],al[0]) print al[1] al 1 al[0] al 0 exit() exit res = [] res [] neg = [] neg [] pos = [] pos [] for a in al:
    if a>=0:
        pos.append(a)
    else:
        neg.append(a) a al if a>=0:
        pos.append(a)
    else:
        neg.append(a) a>=0 a 0 pos.append(a) pos.append pos append a neg.append(a) neg.append neg append a if len(pos)==0:
    res.append((neg[-1],neg[-2]))
    pos.append(neg[-1]-neg[-2])
    neg = neg[:-2] len(pos)==0 len(pos) len pos 0 res.append((neg[-1],neg[-2])) res.append res append (neg[-1],neg[-2]) neg[-1] neg -1 neg[-2] neg -2 pos.append(neg[-1]-neg[-2]) pos.append pos append neg[-1]-neg[-2] neg[-1] neg -1 neg[-2] neg -2 neg = neg[:-2] neg neg[:-2] neg :-2 -2 if len(neg)==0:
    res.append((pos[0],pos[1]))
    neg.append(pos[0]-pos[1])
    pos = pos[2:]


# len(pos)>0 and len(neg)>0 len(neg)==0 len(neg) len neg 0 res.append((pos[0],pos[1])) res.append res append (pos[0],pos[1]) pos[0] pos 0 pos[1] pos 1 neg.append(pos[0]-pos[1]) neg.append neg append pos[0]-pos[1] pos[0] pos 0 pos[1] pos 1 pos = pos[2:] pos pos[2:] pos 2: 2 n = neg[0] n neg[0] neg 0 for i in range(1,len(pos)):
    res.append((n,pos[i]))
    n = n - pos[i] i range(1,len(pos)) range 1 len(pos) len pos res.append((n,pos[i])) res.append res append (n,pos[i]) n pos[i] pos i n = n - pos[i] n n - pos[i] n pos[i] pos i p = pos[0] p pos[0] pos 0 for i in range(1,len(neg)):
    res.append((p,neg[i]))
    p = p - neg[i] i range(1,len(neg)) range 1 len(neg) len neg res.append((p,neg[i])) res.append res append (p,neg[i]) p neg[i] neg i p = p - neg[i] p p - neg[i] p neg[i] neg i res.append((p,n)) res.append res append (p,n) p n print(p-n) print p-n p n for x,y in res:
    print(x,y) x y res print(x,y) print x y n = n - pos[i] n - pos[i] n n = int(input()) int(input()) n pos = pos[2:] pos[2:] pos res = [] [] res p = p - neg[i] p - neg[i] p al = list(map(int, input().split())) list(map(int, input().split())) al neg = [] [] neg pos = [] [] pos p = pos[0] pos[0] p n = neg[0] neg[0] n neg = neg[:-2] neg[:-2] neg
n = int(input())
al = list(map(int, input().split()))
al.sort()

if n==2:
    print(al[1]-al[0])
    print(al[1],al[0])
    exit()

res = []
neg = []
pos = []
for a in al:
    if a>=0:
        pos.append(a)
    else:
        neg.append(a)

if len(pos)==0:
    res.append((neg[-1],neg[-2]))
    pos.append(neg[-1]-neg[-2])
    neg = neg[:-2]
if len(neg)==0:
    res.append((pos[0],pos[1]))
    neg.append(pos[0]-pos[1])
    pos = pos[2:]


# len(pos)>0 and len(neg)>0
n = neg[0]
for i in range(1,len(pos)):
    res.append((n,pos[i]))
    n = n - pos[i]
p = pos[0]
for i in range(1,len(neg)):
    res.append((p,neg[i]))
    p = p - neg[i]
res.append((p,n))
print(p-n)
for x,y in res:
    print(x,y)