n = int(input())
A = list(map(int,input().split()))
A.sort()
ans = []

# 全て正
if min(A)>=0:
    print(sum(A)-2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        elif i==n-1:
            print(A[i], x)
        else:
            print(x, A[i])
            x -= A[i]

# 全て負
elif max(A)<=0:
    A = A[::-1]
    print(sum(A)*(-1)+2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        else:
            print(x, A[i])
            x -= A[i]

# 正負
else:
    m,p = [], []
    for a in A:
        if a<0:
            m.append(a)
        else:
            p.append(a)
    print(sum(p)-sum(m))
    m.sort()
    p.sort()
    x = m[0]
    for i in range(len(p)-1):
        print(x, p[i])
        x -= p[i]
    else:
        print(p[-1], x)
        x = p[-1] - x
        
    for j in range(1, len(m)):
        print(x, m[j])
        x -= m[j] 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 ans = [] ans [] if min(A)>=0:
    print(sum(A)-2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        elif i==n-1:
            print(A[i], x)
        else:
            print(x, A[i])
            x -= A[i]

# 全て負
elif max(A)<=0:
    A = A[::-1]
    print(sum(A)*(-1)+2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        else:
            print(x, A[i])
            x -= A[i]

# 正負
else:
    m,p = [], []
    for a in A:
        if a<0:
            m.append(a)
        else:
            p.append(a)
    print(sum(p)-sum(m))
    m.sort()
    p.sort()
    x = m[0]
    for i in range(len(p)-1):
        print(x, p[i])
        x -= p[i]
    else:
        print(p[-1], x)
        x = p[-1] - x
        
    for j in range(1, len(m)):
        print(x, m[j])
        x -= m[j] min(A)>=0 min(A) min A 0 print(sum(A)-2*A[0]) print sum(A)-2*A[0] sum(A) sum A 2*A[0] 2 A[0] A 0 for i in range(n):
        if i==0:
            x = A[i]
        elif i==n-1:
            print(A[i], x)
        else:
            print(x, A[i])
            x -= A[i]

# 全て負 i range(n) range n if i==0:
            x = A[i]
        elif i==n-1:
            print(A[i], x)
        else:
            print(x, A[i])
            x -= A[i]

# 全て負 i==0 i 0 x = A[i] x A[i] A i elif i==n-1:
            print(A[i], x)
         i==n-1 i n-1 n 1 print(A[i], x) print A[i] A i x print(x, A[i]) print x A[i] A i x -= A[i] x A[i] A i elif max(A)<=0:
    A = A[::-1]
    print(sum(A)*(-1)+2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        else:
            print(x, A[i])
            x -= A[i]

# 正負 max(A)<=0 max(A) max A 0 A = A[::-1] A A[::-1] A ::-1 -1 print(sum(A)*(-1)+2*A[0]) print sum(A)*(-1)+2*A[0] sum(A)*(-1) sum(A) sum A -1 2*A[0] 2 A[0] A 0 for i in range(n):
        if i==0:
            x = A[i]
        else:
            print(x, A[i])
            x -= A[i]

# 正負 i range(n) range n if i==0:
            x = A[i]
        else:
            print(x, A[i])
            x -= A[i]

# 正負 i==0 i 0 x = A[i] x A[i] A i print(x, A[i]) print x A[i] A i x -= A[i] x A[i] A i m,p = [], [] m [] p [] for a in A:
        if a<0:
            m.append(a)
        else:
            p.append(a)
     a A if a<0:
            m.append(a)
        else:
            p.append(a)
     a<0 a 0 m.append(a) m.append m append a p.append(a) p.append p append a print(sum(p)-sum(m)) print sum(p)-sum(m) sum(p) sum p sum(m) sum m m.sort() m.sort m sort p.sort() p.sort p sort x = m[0] x m[0] m 0 for i in range(len(p)-1):
        print(x, p[i])
        x -= p[i]
    else:
        print(p[-1], x)
        x = p[-1] - x
        
     i range(len(p)-1) range len(p)-1 len(p) len p 1 print(x, p[i]) print x p[i] p i x -= p[i] x p[i] p i print(p[-1], x) print p[-1] p -1 x x = p[-1] - x x p[-1] - x p[-1] p -1 x for j in range(1, len(m)):
        print(x, m[j])
        x -= m[j] j range(1, len(m)) range 1 len(m) len m print(x, m[j]) print x m[j] m j x -= m[j] x m[j] m j p = [], [] [] p A = A[::-1] A[::-1] A x = p[-1] - x p[-1] - x x A = list(map(int,input().split())) list(map(int,input().split())) A x -= p[i] p[i] x x -= A[i] A[i] x n = int(input()) int(input()) n x = m[0] m[0] x x -= m[j] m[j] x x -= A[i] A[i] x m,p = [], [] [] m ans = [] [] ans x = A[i] A[i] x x = A[i] A[i] x
n = int(input())
A = list(map(int,input().split()))
A.sort()
ans = []

# 全て正
if min(A)>=0:
    print(sum(A)-2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        elif i==n-1:
            print(A[i], x)
        else:
            print(x, A[i])
            x -= A[i]

# 全て負
elif max(A)<=0:
    A = A[::-1]
    print(sum(A)*(-1)+2*A[0])
    for i in range(n):
        if i==0:
            x = A[i]
        else:
            print(x, A[i])
            x -= A[i]

# 正負
else:
    m,p = [], []
    for a in A:
        if a<0:
            m.append(a)
        else:
            p.append(a)
    print(sum(p)-sum(m))
    m.sort()
    p.sort()
    x = m[0]
    for i in range(len(p)-1):
        print(x, p[i])
        x -= p[i]
    else:
        print(p[-1], x)
        x = p[-1] - x
        
    for j in range(1, len(m)):
        print(x, m[j])
        x -= m[j]