import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))

a.sort()
mc = sum(item<0 for item in a)
ans = []
if mc==1 or mc==0:
    val = a[0]
    for i in range(n-2):
        ans.append((val, a[i+1]))
        val = val - a[i+1]
    ans.append((a[n-1], val))
    value = a[n-1] - val
elif mc<n:
    val = a[-1]
    for i in range(mc-1):
        ans.append((val, a[i]))
        val -= a[i]
    val2 = a[mc-1]
    for i in range(mc, n-1):
        ans.append((val2, a[i]))
        val2 -= a[i]
    ans.append((val, val2))
    value = val-val2
else:
    val = a[-1]
    for i in range(n-1):
        ans.append((val, a[i]))
        val -= a[i]
    value = val
        
print(value)
write("\n".join(" ".join(map(str, item)) for item in ans)) import sys sys input = lambda : sys.stdin.readline().rstrip() input lambda : sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(max(1000, 10**9)) sys.setrecursionlimit sys setrecursionlimit max(1000, 10**9) max 1000 10**9 10 9 write = lambda x: sys.stdout.write(x+"\n") write lambda x: sys.stdout.write(x+"\n") sys.stdout.write(x+"\n") sys.stdout.write sys.stdout sys stdout write x+"\n" x "\n" x 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 mc = sum(item<0 for item in a) mc sum(item<0 for item in a) sum item<0 item 0 ans = [] ans [] if mc==1 or mc==0:
    val = a[0]
    for i in range(n-2):
        ans.append((val, a[i+1]))
        val = val - a[i+1]
    ans.append((a[n-1], val))
    value = a[n-1] - val
elif mc<n:
    val = a[-1]
    for i in range(mc-1):
        ans.append((val, a[i]))
        val -= a[i]
    val2 = a[mc-1]
    for i in range(mc, n-1):
        ans.append((val2, a[i]))
        val2 -= a[i]
    ans.append((val, val2))
    value = val-val2
else:
    val = a[-1]
    for i in range(n-1):
        ans.append((val, a[i]))
        val -= a[i]
    value = val
         mc==1 or mc==0 mc==1 mc 1 mc==0 mc 0 val = a[0] val a[0] a 0 for i in range(n-2):
        ans.append((val, a[i+1]))
        val = val - a[i+1]
     i range(n-2) range n-2 n 2 ans.append((val, a[i+1])) ans.append ans append (val, a[i+1]) val a[i+1] a i+1 i 1 val = val - a[i+1] val val - a[i+1] val a[i+1] a i+1 i 1 ans.append((a[n-1], val)) ans.append ans append (a[n-1], val) a[n-1] a n-1 n 1 val value = a[n-1] - val value a[n-1] - val a[n-1] a n-1 n 1 val elif mc<n:
    val = a[-1]
    for i in range(mc-1):
        ans.append((val, a[i]))
        val -= a[i]
    val2 = a[mc-1]
    for i in range(mc, n-1):
        ans.append((val2, a[i]))
        val2 -= a[i]
    ans.append((val, val2))
    value = val-val2 mc<n mc n val = a[-1] val a[-1] a -1 for i in range(mc-1):
        ans.append((val, a[i]))
        val -= a[i]
     i range(mc-1) range mc-1 mc 1 ans.append((val, a[i])) ans.append ans append (val, a[i]) val a[i] a i val -= a[i] val a[i] a i val2 = a[mc-1] val2 a[mc-1] a mc-1 mc 1 for i in range(mc, n-1):
        ans.append((val2, a[i]))
        val2 -= a[i]
     i range(mc, n-1) range mc n-1 n 1 ans.append((val2, a[i])) ans.append ans append (val2, a[i]) val2 a[i] a i val2 -= a[i] val2 a[i] a i ans.append((val, val2)) ans.append ans append (val, val2) val val2 value = val-val2 value val-val2 val val2 val = a[-1] val a[-1] a -1 for i in range(n-1):
        ans.append((val, a[i]))
        val -= a[i]
     i range(n-1) range n-1 n 1 ans.append((val, a[i])) ans.append ans append (val, a[i]) val a[i] a i val -= a[i] val a[i] a i value = val value val print(value) print value write("\n".join(" ".join(map(str, item)) for item in ans)) write "\n".join(" ".join(map(str, item)) for item in ans) "\n".join "\n" join " ".join(map(str, item)) " ".join " " join map(str, item) map str item n = int(input()) int(input()) n a = list(map(int, input().split())) list(map(int, input().split())) a val = val - a[i+1] val - a[i+1] val mc = sum(item<0 for item in a) sum(item<0 for item in a) mc val2 -= a[i] a[i] val2 val = a[0] a[0] val val = a[-1] a[-1] val value = val-val2 val-val2 value value = a[n-1] - val a[n-1] - val value write = lambda x: sys.stdout.write(x+"\n") lambda x: sys.stdout.write(x+"\n") write val2 = a[mc-1] a[mc-1] val2 val -= a[i] a[i] val value = val val value input = lambda : sys.stdin.readline().rstrip() lambda : sys.stdin.readline().rstrip() input val -= a[i] a[i] val ans = [] [] ans val = a[-1] a[-1] val
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))

a.sort()
mc = sum(item<0 for item in a)
ans = []
if mc==1 or mc==0:
    val = a[0]
    for i in range(n-2):
        ans.append((val, a[i+1]))
        val = val - a[i+1]
    ans.append((a[n-1], val))
    value = a[n-1] - val
elif mc<n:
    val = a[-1]
    for i in range(mc-1):
        ans.append((val, a[i]))
        val -= a[i]
    val2 = a[mc-1]
    for i in range(mc, n-1):
        ans.append((val2, a[i]))
        val2 -= a[i]
    ans.append((val, val2))
    value = val-val2
else:
    val = a[-1]
    for i in range(n-1):
        ans.append((val, a[i]))
        val -= a[i]
    value = val
        
print(value)
write("\n".join(" ".join(map(str, item)) for item in ans))