n = int(input())
a = list(map(int,input().split()))
a.sort()
aminus = []
aplus = []
p = 0
q = 0
for i in a:
    if i >= 0:
        aplus.append(i)
        p += 1
    elif i < 0:
        aminus.append(i)
        q += 1
ans = []
cou = 0
if aplus and aminus:
    now = aminus[0]
    for i in range(p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    aminus[0] = now
    now = aplus[p-1]
    for i in range(q):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now
elif aplus:
    now = aplus[0]
    for i in range(1,p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    ans.append((aplus[p-1],now))
    cou = aplus[p-1] - now
elif aminus:
    now = aminus[q-1]
    for i in range(q-1):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now

print(cou)
for i in range(n-1):
    print(*ans[i]) 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 aminus = [] aminus [] aplus = [] aplus [] p = 0 p 0 q = 0 q 0 for i in a:
    if i >= 0:
        aplus.append(i)
        p += 1
    elif i < 0:
        aminus.append(i)
        q += 1 i a if i >= 0:
        aplus.append(i)
        p += 1
    elif i < 0:
        aminus.append(i)
        q += 1 i >= 0 i 0 aplus.append(i) aplus.append aplus append i p += 1 p 1 elif i < 0:
        aminus.append(i)
        q += 1 i < 0 i 0 aminus.append(i) aminus.append aminus append i q += 1 q 1 ans = [] ans [] cou = 0 cou 0 if aplus and aminus:
    now = aminus[0]
    for i in range(p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    aminus[0] = now
    now = aplus[p-1]
    for i in range(q):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now
elif aplus:
    now = aplus[0]
    for i in range(1,p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    ans.append((aplus[p-1],now))
    cou = aplus[p-1] - now
elif aminus:
    now = aminus[q-1]
    for i in range(q-1):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now aplus and aminus aplus aminus now = aminus[0] now aminus[0] aminus 0 for i in range(p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
     i range(p-1) range p-1 p 1 ans.append((now,aplus[i])) ans.append ans append (now,aplus[i]) now aplus[i] aplus i now = now - aplus[i] now now - aplus[i] now aplus[i] aplus i aminus[0] = now aminus[0] aminus 0 now now = aplus[p-1] now aplus[p-1] aplus p-1 p 1 for i in range(q):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
     i range(q) range q ans.append((now,aminus[i])) ans.append ans append (now,aminus[i]) now aminus[i] aminus i now = now - aminus[i] now now - aminus[i] now aminus[i] aminus i cou = now cou now elif aplus:
    now = aplus[0]
    for i in range(1,p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    ans.append((aplus[p-1],now))
    cou = aplus[p-1] - now aplus now = aplus[0] now aplus[0] aplus 0 for i in range(1,p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
     i range(1,p-1) range 1 p-1 p 1 ans.append((now,aplus[i])) ans.append ans append (now,aplus[i]) now aplus[i] aplus i now = now - aplus[i] now now - aplus[i] now aplus[i] aplus i ans.append((aplus[p-1],now)) ans.append ans append (aplus[p-1],now) aplus[p-1] aplus p-1 p 1 now cou = aplus[p-1] - now cou aplus[p-1] - now aplus[p-1] aplus p-1 p 1 now elif aminus:
    now = aminus[q-1]
    for i in range(q-1):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now aminus now = aminus[q-1] now aminus[q-1] aminus q-1 q 1 for i in range(q-1):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
     i range(q-1) range q-1 q 1 ans.append((now,aminus[i])) ans.append ans append (now,aminus[i]) now aminus[i] aminus i now = now - aminus[i] now now - aminus[i] now aminus[i] aminus i cou = now cou now print(cou) print cou for i in range(n-1):
    print(*ans[i]) i range(n-1) range n-1 n 1 print(*ans[i]) print *ans[i] ans[i] ans i now = aplus[0] aplus[0] now p = 0 0 p now = now - aminus[i] now - aminus[i] now now = now - aplus[i] now - aplus[i] now now = aminus[0] aminus[0] now cou = aplus[p-1] - now aplus[p-1] - now cou n = int(input()) int(input()) n cou = now now cou now = aminus[q-1] aminus[q-1] now q += 1 1 q now = aplus[p-1] aplus[p-1] now ans = [] [] ans p += 1 1 p a = list(map(int,input().split())) list(map(int,input().split())) a cou = now now cou aminus = [] [] aminus now = now - aminus[i] now - aminus[i] now q = 0 0 q cou = 0 0 cou aplus = [] [] aplus now = now - aplus[i] now - aplus[i] now
n = int(input())
a = list(map(int,input().split()))
a.sort()
aminus = []
aplus = []
p = 0
q = 0
for i in a:
    if i >= 0:
        aplus.append(i)
        p += 1
    elif i < 0:
        aminus.append(i)
        q += 1
ans = []
cou = 0
if aplus and aminus:
    now = aminus[0]
    for i in range(p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    aminus[0] = now
    now = aplus[p-1]
    for i in range(q):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now
elif aplus:
    now = aplus[0]
    for i in range(1,p-1):
        ans.append((now,aplus[i]))
        now = now - aplus[i]
    ans.append((aplus[p-1],now))
    cou = aplus[p-1] - now
elif aminus:
    now = aminus[q-1]
    for i in range(q-1):
        ans.append((now,aminus[i]))
        now = now - aminus[i]
    cou = now

print(cou)
for i in range(n-1):
    print(*ans[i])
