n = int(input())
a = sorted(map(int, input().split()))
ans = []
for i in range(1, n - 1):
    # +
    if a[i] < 0:
        ans.append([a[-1], a[i]])
        a[-1] -= a[i]
    # -
    else:
        ans.append([a[0], a[i]])
        a[0] -= a[i]
ans.append([a[-1], a[0]])
print(a[-1] - a[0])
for x, y in ans:
    print(x, y) n = int(input()) n int(input()) int input() input a = sorted(map(int, input().split())) a sorted(map(int, input().split())) sorted map(int, input().split()) map int input().split() ().split () input split ans = [] ans [] for i in range(1, n - 1):
    # +
    if a[i] < 0:
        ans.append([a[-1], a[i]])
        a[-1] -= a[i]
    # -
    else:
        ans.append([a[0], a[i]])
        a[0] -= a[i] i range(1, n - 1) range 1 n - 1 n 1 if a[i] < 0:
        ans.append([a[-1], a[i]])
        a[-1] -= a[i]
    # -
    else:
        ans.append([a[0], a[i]])
        a[0] -= a[i] a[i] < 0 a[i] a i 0 ans.append([a[-1], a[i]]) ans.append ans append [a[-1], a[i]] a[-1] a -1 a[i] a i a[-1] -= a[i] a[-1] a -1 a[i] a i ans.append([a[0], a[i]]) ans.append ans append [a[0], a[i]] a[0] a 0 a[i] a i a[0] -= a[i] a[0] a 0 a[i] a i ans.append([a[-1], a[0]]) ans.append ans append [a[-1], a[0]] a[-1] a -1 a[0] a 0 print(a[-1] - a[0]) print a[-1] - a[0] a[-1] a -1 a[0] a 0 for x, y in ans:
    print(x, y) x y ans print(x, y) print x y a = sorted(map(int, input().split())) sorted(map(int, input().split())) a ans = [] [] ans n = int(input()) int(input()) n
n = int(input())
a = sorted(map(int, input().split()))
ans = []
for i in range(1, n - 1):
    # +
    if a[i] < 0:
        ans.append([a[-1], a[i]])
        a[-1] -= a[i]
    # -
    else:
        ans.append([a[0], a[i]])
        a[0] -= a[i]
ans.append([a[-1], a[0]])
print(a[-1] - a[0])
for x, y in ans:
    print(x, y)
