import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
mini = As.pop(0)
maxi = As.pop()

ans = []
for a in As:
    if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append((maxi, a))
        maxi -= a

print(maxi-mini)
for a in ans:
    print(*a)
print(maxi, mini) import sys sys def input(): return sys.stdin.readline().strip() input def mapint(): return map(int, input().split()) mapint sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 N = int(input()) N int(input()) int input() input As = list(mapint()) As list(mapint()) list mapint() mapint As.sort() As.sort As sort mini = As.pop(0) mini As.pop(0) As.pop As pop 0 maxi = As.pop() maxi As.pop() As.pop As pop ans = [] ans [] for a in As:
    if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append((maxi, a))
        maxi -= a a As if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append((maxi, a))
        maxi -= a a>=0 a 0 ans.append((mini, a)) ans.append ans append (mini, a) mini a mini -= a mini a ans.append((maxi, a)) ans.append ans append (maxi, a) maxi a maxi -= a maxi a print(maxi-mini) print maxi-mini maxi mini for a in ans:
    print(*a) a ans print(*a) print *a a print(maxi, mini) print maxi mini maxi -= a a maxi def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input As = list(mapint()) list(mapint()) As mini = As.pop(0) As.pop(0) mini def mapint(): return map(int, input().split()) def mapint(): return map(int, input().split()) mapint ans = [] [] ans maxi = As.pop() As.pop() maxi N = int(input()) int(input()) N mini -= a a mini
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
As.sort()
mini = As.pop(0)
maxi = As.pop()

ans = []
for a in As:
    if a>=0:
        ans.append((mini, a))
        mini -= a
    else:
        ans.append((maxi, a))
        maxi -= a

print(maxi-mini)
for a in ans:
    print(*a)
print(maxi, mini)