n = int(input())
arr = sorted(list(map(int,input().split())))
ans = 0
ok1 = False
ok2 = False
for i in arr:
    if i > 0:
        ok1 = True
    else:
        ok2 = True
if ok1 and ok2:
    for i in arr:
        ans += i if i > 0 else -i
    print(ans)
    ope1 = arr.pop()
    ope2 = arr.pop(0)
    for a in arr:
        if a > 0:
            print(ope2,a)
            ope2 -= a
        else:
            print(ope1,a)
            ope1 -= a
    print(ope1,ope2)
else:
    if ok1:
        ans = sum(arr) - 2*arr[0]
        print(ans)
        ope1 = arr.pop(0)
        for i in range(n-2):
            print(ope1,arr[i])
            ope1 -= arr[i]
        print(arr[-1],ope1)
    else:
        ans = -sum(arr) + 2*arr[-1]
        print(ans)
        ope2 = arr.pop(-1)
        for i in range(n-1):
            print(ope2,arr[i])
            ope2 -= arr[i] n = int(input()) n int(input()) int input() input arr = sorted(list(map(int,input().split()))) arr sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans = 0 ans 0 ok1 = False ok1 False ok2 = False ok2 False for i in arr:
    if i > 0:
        ok1 = True
    else:
        ok2 = True i arr if i > 0:
        ok1 = True
    else:
        ok2 = True i > 0 i 0 ok1 = True ok1 True ok2 = True ok2 True if ok1 and ok2:
    for i in arr:
        ans += i if i > 0 else -i
    print(ans)
    ope1 = arr.pop()
    ope2 = arr.pop(0)
    for a in arr:
        if a > 0:
            print(ope2,a)
            ope2 -= a
        else:
            print(ope1,a)
            ope1 -= a
    print(ope1,ope2)
else:
    if ok1:
        ans = sum(arr) - 2*arr[0]
        print(ans)
        ope1 = arr.pop(0)
        for i in range(n-2):
            print(ope1,arr[i])
            ope1 -= arr[i]
        print(arr[-1],ope1)
    else:
        ans = -sum(arr) + 2*arr[-1]
        print(ans)
        ope2 = arr.pop(-1)
        for i in range(n-1):
            print(ope2,arr[i])
            ope2 -= arr[i] ok1 and ok2 ok1 ok2 for i in arr:
        ans += i if i > 0 else -i
     i arr ans += i if i > 0 else -i ans i if i > 0 else -i i > 0 i 0 i -i i print(ans) print ans ope1 = arr.pop() ope1 arr.pop() arr.pop arr pop ope2 = arr.pop(0) ope2 arr.pop(0) arr.pop arr pop 0 for a in arr:
        if a > 0:
            print(ope2,a)
            ope2 -= a
        else:
            print(ope1,a)
            ope1 -= a
     a arr if a > 0:
            print(ope2,a)
            ope2 -= a
        else:
            print(ope1,a)
            ope1 -= a
     a > 0 a 0 print(ope2,a) print ope2 a ope2 -= a ope2 a print(ope1,a) print ope1 a ope1 -= a ope1 a print(ope1,ope2) print ope1 ope2 if ok1:
        ans = sum(arr) - 2*arr[0]
        print(ans)
        ope1 = arr.pop(0)
        for i in range(n-2):
            print(ope1,arr[i])
            ope1 -= arr[i]
        print(arr[-1],ope1)
    else:
        ans = -sum(arr) + 2*arr[-1]
        print(ans)
        ope2 = arr.pop(-1)
        for i in range(n-1):
            print(ope2,arr[i])
            ope2 -= arr[i] ok1 ans = sum(arr) - 2*arr[0] ans sum(arr) - 2*arr[0] sum(arr) sum arr 2*arr[0] 2 arr[0] arr 0 print(ans) print ans ope1 = arr.pop(0) ope1 arr.pop(0) arr.pop arr pop 0 for i in range(n-2):
            print(ope1,arr[i])
            ope1 -= arr[i]
         i range(n-2) range n-2 n 2 print(ope1,arr[i]) print ope1 arr[i] arr i ope1 -= arr[i] ope1 arr[i] arr i print(arr[-1],ope1) print arr[-1] arr -1 ope1 ans = -sum(arr) + 2*arr[-1] ans -sum(arr) + 2*arr[-1] -sum(arr) sum(arr) sum arr 2*arr[-1] 2 arr[-1] arr -1 print(ans) print ans ope2 = arr.pop(-1) ope2 arr.pop(-1) arr.pop arr pop -1 for i in range(n-1):
            print(ope2,arr[i])
            ope2 -= arr[i] i range(n-1) range n-1 n 1 print(ope2,arr[i]) print ope2 arr[i] arr i ope2 -= arr[i] ope2 arr[i] arr i ope1 = arr.pop() arr.pop() ope1 ope2 = arr.pop(0) arr.pop(0) ope2 ok1 = False False ok1 ope2 -= a a ope2 ope1 -= arr[i] arr[i] ope1 ans = 0 0 ans ok2 = False False ok2 ok1 = True True ok1 n = int(input()) int(input()) n arr = sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) arr ok2 = True True ok2 ope1 -= a a ope1 ope1 = arr.pop(0) arr.pop(0) ope1 ope2 -= arr[i] arr[i] ope2 ans = sum(arr) - 2*arr[0] sum(arr) - 2*arr[0] ans ope2 = arr.pop(-1) arr.pop(-1) ope2 ans += i if i > 0 else -i i if i > 0 else -i ans ans = -sum(arr) + 2*arr[-1] -sum(arr) + 2*arr[-1] ans
n = int(input())
arr = sorted(list(map(int,input().split())))
ans = 0
ok1 = False
ok2 = False
for i in arr:
    if i > 0:
        ok1 = True
    else:
        ok2 = True
if ok1 and ok2:
    for i in arr:
        ans += i if i > 0 else -i
    print(ans)
    ope1 = arr.pop()
    ope2 = arr.pop(0)
    for a in arr:
        if a > 0:
            print(ope2,a)
            ope2 -= a
        else:
            print(ope1,a)
            ope1 -= a
    print(ope1,ope2)
else:
    if ok1:
        ans = sum(arr) - 2*arr[0]
        print(ans)
        ope1 = arr.pop(0)
        for i in range(n-2):
            print(ope1,arr[i])
            ope1 -= arr[i]
        print(arr[-1],ope1)
    else:
        ans = -sum(arr) + 2*arr[-1]
        print(ans)
        ope2 = arr.pop(-1)
        for i in range(n-1):
            print(ope2,arr[i])
            ope2 -= arr[i]
