N=int(input())
A=list(map(int,input().split()))
m,p=[],[]
for i in A:
    if i>=0:
        p.append(i)
    else:
        m.append(i)
if m and p:
    print(sum(p)-sum(m))
    t=m[0]
    for i in p[:-1]:
        print(t,i)
        t-=i
    print(p[-1],t)
    t=p[-1]-t
    for i in m[1:]:
        print(t,i)
        t-=i
elif p:
    p.sort()
    print(sum(p[1:])-p[0])
    t=p[0]
    for i in p[1:-1]:
        print(t,i)
        t-=i
    print(p[-1],t)
else:
    m.sort(reverse=1)
    print(m[0]-sum(m[1:]))
    t=m[0]
    for i in m[1:]:
        print(t,i)
        t-=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 m,p=[],[] m [] p [] for i in A:
    if i>=0:
        p.append(i)
    else:
        m.append(i) i A if i>=0:
        p.append(i)
    else:
        m.append(i) i>=0 i 0 p.append(i) p.append p append i m.append(i) m.append m append i if m and p:
    print(sum(p)-sum(m))
    t=m[0]
    for i in p[:-1]:
        print(t,i)
        t-=i
    print(p[-1],t)
    t=p[-1]-t
    for i in m[1:]:
        print(t,i)
        t-=i
elif p:
    p.sort()
    print(sum(p[1:])-p[0])
    t=p[0]
    for i in p[1:-1]:
        print(t,i)
        t-=i
    print(p[-1],t)
else:
    m.sort(reverse=1)
    print(m[0]-sum(m[1:]))
    t=m[0]
    for i in m[1:]:
        print(t,i)
        t-=i m and p m p print(sum(p)-sum(m)) print sum(p)-sum(m) sum(p) sum p sum(m) sum m t=m[0] t m[0] m 0 for i in p[:-1]:
        print(t,i)
        t-=i
     i p[:-1] p :-1 -1 print(t,i) print t i t-=i t i print(p[-1],t) print p[-1] p -1 t t=p[-1]-t t p[-1]-t p[-1] p -1 t for i in m[1:]:
        print(t,i)
        t-=i i m[1:] m 1: 1 print(t,i) print t i t-=i t i elif p:
    p.sort()
    print(sum(p[1:])-p[0])
    t=p[0]
    for i in p[1:-1]:
        print(t,i)
        t-=i
    print(p[-1],t) p p.sort() p.sort p sort print(sum(p[1:])-p[0]) print sum(p[1:])-p[0] sum(p[1:]) sum p[1:] p 1: 1 p[0] p 0 t=p[0] t p[0] p 0 for i in p[1:-1]:
        print(t,i)
        t-=i
     i p[1:-1] p 1:-1 1 -1 print(t,i) print t i t-=i t i print(p[-1],t) print p[-1] p -1 t m.sort(reverse=1) m.sort m sort reverse=1 reverse 1 print(m[0]-sum(m[1:])) print m[0]-sum(m[1:]) m[0] m 0 sum(m[1:]) sum m[1:] m 1: 1 t=m[0] t m[0] m 0 for i in m[1:]:
        print(t,i)
        t-=i i m[1:] m 1: 1 print(t,i) print t i t-=i t i t-=i i t p=[],[] [] p A=list(map(int,input().split())) list(map(int,input().split())) A t=m[0] m[0] t t=p[-1]-t p[-1]-t t m,p=[],[] [] m t=p[0] p[0] t t-=i i t N=int(input()) int(input()) N t=m[0] m[0] t t-=i i t t-=i i t
N=int(input())
A=list(map(int,input().split()))
m,p=[],[]
for i in A:
    if i>=0:
        p.append(i)
    else:
        m.append(i)
if m and p:
    print(sum(p)-sum(m))
    t=m[0]
    for i in p[:-1]:
        print(t,i)
        t-=i
    print(p[-1],t)
    t=p[-1]-t
    for i in m[1:]:
        print(t,i)
        t-=i
elif p:
    p.sort()
    print(sum(p[1:])-p[0])
    t=p[0]
    for i in p[1:-1]:
        print(t,i)
        t-=i
    print(p[-1],t)
else:
    m.sort(reverse=1)
    print(m[0]-sum(m[1:]))
    t=m[0]
    for i in m[1:]:
        print(t,i)
        t-=i