import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n = inp()
    a = inpl()
    a.sort()
    ans = []
    cnt = 0
    if a[0] >= 0:
        x = a[0]
        for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
        ans.append((a[n-1],x))
        cnt = a[n-1]-x        
    elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
    else:
        for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
        for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
        a[index-1] = x
        x = a[index]
        for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x        
    print(cnt)
    for i in range(n-1):
        print(*ans[i])

if __name__ == "__main__":
    main() import sys, bisect, math, itertools, string, queue, copy sys bisect math itertools string queue copy from collections import Counter,defaultdict,deque from itertools import permutations, combinations from heapq import heappop, heappush sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 def inp(): return int(input()) # n=1 inp def inpm(): return map(int,input().split()) # x=1,y=2 inpm def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n] inpl def inpls(): return list(input().split())  # a=['1','2','3',...,'n'] inpls def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行 inplm n n list(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(input()) list input() input def inplL(n): return [list(input()) for _ in range(n)] inplL n n tuple(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) tuple(input()) tuple input() input def inplT(n): return [tuple(input()) for _ in range(n)] inplT n n list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]  inpll n n list(map(int, input().split())) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]  inplls n n def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g graph n=inp() n inp() inp [] for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [] g=[[] for _ in range(n)] g [[] for _ in range(n)] for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
     i range(n) range n a = inp() a inp() inp a -= 1 a 1 g[i].append(a) [i].append [i] g i append a g[a].append(i) [a].append [a] g a append i return n,g return n,g n g def main():
    n = inp()
    a = inpl()
    a.sort()
    ans = []
    cnt = 0
    if a[0] >= 0:
        x = a[0]
        for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
        ans.append((a[n-1],x))
        cnt = a[n-1]-x        
    elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
    else:
        for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
        for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
        a[index-1] = x
        x = a[index]
        for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x        
    print(cnt)
    for i in range(n-1):
        print(*ans[i]) main n = inp() n inp() inp a = inpl() a inpl() inpl a.sort() a.sort a sort ans = [] ans [] cnt = 0 cnt 0 if a[0] >= 0:
        x = a[0]
        for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
        ans.append((a[n-1],x))
        cnt = a[n-1]-x        
    elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
    else:
        for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
        for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
        a[index-1] = x
        x = a[index]
        for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x        
     a[0] >= 0 a[0] a 0 0 x = a[0] x a[0] a 0 for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
         i range(n-2) range n-2 n 2 ans.append((x,a[i+1])) ans.append ans append (x,a[i+1]) x a[i+1] a i+1 i 1 x -= a[i+1] x a[i+1] a i+1 i 1 ans.append((a[n-1],x)) ans.append ans append (a[n-1],x) a[n-1] a n-1 n 1 x cnt = a[n-1]-x cnt a[n-1]-x a[n-1] a n-1 n 1 x elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
     a[n-1] <= 0 a[n-1] a n-1 n 1 0 x = a[n-1] x a[n-1] a n-1 n 1 for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
         i range(n-1) range n-1 n 1 ans.append((x,a[i])) ans.append ans append (x,a[i]) x a[i] a i x -= a[i] x a[i] a i cnt = x cnt x for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
         i range(n) range n if a[i] >= 0:
                x = a[i-1]
                index = i
                break
         a[i] >= 0 a[i] a i 0 x = a[i-1] x a[i-1] a i-1 i 1 index = i index i break for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
         i range(index+1,n) range index+1 index 1 n ans.append((x,a[i])) ans.append ans append (x,a[i]) x a[i] a i x -= a[i] x a[i] a i a[index-1] = x a[index-1] a index-1 index 1 x x = a[index] x a[index] a index for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
         i range(index) range index ans.append((x,a[i])) ans.append ans append (x,a[i]) x a[i] a i x -= a[i] x a[i] a i cnt = x cnt x print(cnt) print cnt 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 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def inplT(n): return [tuple(input()) for _ in range(n)] def inplT(n): return [tuple(input()) for _ in range(n)] inplT mod = 10**9+7 10**9+7 mod def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]  def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]  inpll def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n] def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n] inpl def inp(): return int(input()) # n=1 def inp(): return int(input()) # n=1 inp def inpls(): return list(input().split())  # a=['1','2','3',...,'n'] def inpls(): return list(input().split())  # a=['1','2','3',...,'n'] inpls def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行 def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行 inplm def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g graph def main():
    n = inp()
    a = inpl()
    a.sort()
    ans = []
    cnt = 0
    if a[0] >= 0:
        x = a[0]
        for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
        ans.append((a[n-1],x))
        cnt = a[n-1]-x        
    elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
    else:
        for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
        for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
        a[index-1] = x
        x = a[index]
        for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x        
    print(cnt)
    for i in range(n-1):
        print(*ans[i]) def main():
    n = inp()
    a = inpl()
    a.sort()
    ans = []
    cnt = 0
    if a[0] >= 0:
        x = a[0]
        for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
        ans.append((a[n-1],x))
        cnt = a[n-1]-x        
    elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
    else:
        for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
        for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
        a[index-1] = x
        x = a[index]
        for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x        
    print(cnt)
    for i in range(n-1):
        print(*ans[i]) main def inpm(): return map(int,input().split()) # x=1,y=2 def inpm(): return map(int,input().split()) # x=1,y=2 inpm def inplL(n): return [list(input()) for _ in range(n)] def inplL(n): return [list(input()) for _ in range(n)] inplL def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]  def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]  inplls
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    n = inp()
    a = inpl()
    a.sort()
    ans = []
    cnt = 0
    if a[0] >= 0:
        x = a[0]
        for i in range(n-2):
            ans.append((x,a[i+1]))
            x -= a[i+1]
        ans.append((a[n-1],x))
        cnt = a[n-1]-x        
    elif a[n-1] <= 0:
        x = a[n-1]
        for i in range(n-1):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x
    else:
        for i in range(n):
            if a[i] >= 0:
                x = a[i-1]
                index = i
                break
        for i in range(index+1,n):
            ans.append((x,a[i]))
            x -= a[i]
        a[index-1] = x
        x = a[index]
        for i in range(index):
            ans.append((x,a[i]))
            x -= a[i]
        cnt = x        
    print(cnt)
    for i in range(n-1):
        print(*ans[i])

if __name__ == "__main__":
    main()