import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
a_ls.sort()
flg = True
if a_ls[-1] < 0:
    score = - sum(a_ls) + a_ls[-1] * 2
    flg = False
elif a_ls[1] < 0:
    score = sum([abs(a) for a in a_ls])
else:
    score = sum(a_ls) - a_ls[0] * 2
cur = a_ls[0]
last = a_ls[-1]
print(score)
if flg:
    for i in range(1,n):
        a = a_ls[i]
        if a < 0:
            print(last, a)
            last -= a
            continue
        if i < n - 1:
            print(cur, a_ls[i])
            cur -= a_ls[i]
        else:
            print(last, cur)
else:
    for i in range(n-1):
        print(last, a_ls[i])
        last -= a_ls[i] import sys sys n = int(input()) n int(input()) int input() input int(i) for i in sys.stdin.readline().split() for i in sys.stdin.readline().split() i sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for i in sys.stdin.readline().split() int(i) int i a_ls = [int(i) for i in sys.stdin.readline().split()] a_ls [int(i) for i in sys.stdin.readline().split()] a_ls.sort() a_ls.sort a_ls sort flg = True flg True if a_ls[-1] < 0:
    score = - sum(a_ls) + a_ls[-1] * 2
    flg = False
elif a_ls[1] < 0:
    score = sum([abs(a) for a in a_ls])
else:
    score = sum(a_ls) - a_ls[0] * 2 a_ls[-1] < 0 a_ls[-1] a_ls -1 0 score = - sum(a_ls) + a_ls[-1] * 2 score - sum(a_ls) + a_ls[-1] * 2 - sum(a_ls) sum(a_ls) sum a_ls a_ls[-1] * 2 a_ls[-1] a_ls -1 2 flg = False flg False elif a_ls[1] < 0:
    score = sum([abs(a) for a in a_ls]) a_ls[1] < 0 a_ls[1] a_ls 1 0 abs(a) for a in a_ls for a in a_ls a a_ls for a in a_ls abs(a) abs a score = sum([abs(a) for a in a_ls]) score sum([abs(a) for a in a_ls]) sum [abs(a) for a in a_ls] score = sum(a_ls) - a_ls[0] * 2 score sum(a_ls) - a_ls[0] * 2 sum(a_ls) sum a_ls a_ls[0] * 2 a_ls[0] a_ls 0 2 cur = a_ls[0] cur a_ls[0] a_ls 0 last = a_ls[-1] last a_ls[-1] a_ls -1 print(score) print score if flg:
    for i in range(1,n):
        a = a_ls[i]
        if a < 0:
            print(last, a)
            last -= a
            continue
        if i < n - 1:
            print(cur, a_ls[i])
            cur -= a_ls[i]
        else:
            print(last, cur)
else:
    for i in range(n-1):
        print(last, a_ls[i])
        last -= a_ls[i] flg for i in range(1,n):
        a = a_ls[i]
        if a < 0:
            print(last, a)
            last -= a
            continue
        if i < n - 1:
            print(cur, a_ls[i])
            cur -= a_ls[i]
        else:
            print(last, cur) i range(1,n) range 1 n a = a_ls[i] a a_ls[i] a_ls i if a < 0:
            print(last, a)
            last -= a
            continue
         a < 0 a 0 print(last, a) print last a last -= a last a continue if i < n - 1:
            print(cur, a_ls[i])
            cur -= a_ls[i]
        else:
            print(last, cur) i < n - 1 i n - 1 n 1 print(cur, a_ls[i]) print cur a_ls[i] a_ls i cur -= a_ls[i] cur a_ls[i] a_ls i print(last, cur) print last cur for i in range(n-1):
        print(last, a_ls[i])
        last -= a_ls[i] i range(n-1) range n-1 n 1 print(last, a_ls[i]) print last a_ls[i] a_ls i last -= a_ls[i] last a_ls[i] a_ls i flg = True True flg score = sum([abs(a) for a in a_ls]) sum([abs(a) for a in a_ls]) score a_ls = [int(i) for i in sys.stdin.readline().split()] [int(i) for i in sys.stdin.readline().split()] a_ls flg = False False flg cur = a_ls[0] a_ls[0] cur a = a_ls[i] a_ls[i] a last -= a_ls[i] a_ls[i] last n = int(input()) int(input()) n cur -= a_ls[i] a_ls[i] cur score = sum(a_ls) - a_ls[0] * 2 sum(a_ls) - a_ls[0] * 2 score score = - sum(a_ls) + a_ls[-1] * 2 - sum(a_ls) + a_ls[-1] * 2 score last = a_ls[-1] a_ls[-1] last last -= a a last
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
a_ls.sort()
flg = True
if a_ls[-1] < 0:
    score = - sum(a_ls) + a_ls[-1] * 2
    flg = False
elif a_ls[1] < 0:
    score = sum([abs(a) for a in a_ls])
else:
    score = sum(a_ls) - a_ls[0] * 2
cur = a_ls[0]
last = a_ls[-1]
print(score)
if flg:
    for i in range(1,n):
        a = a_ls[i]
        if a < 0:
            print(last, a)
            last -= a
            continue
        if i < n - 1:
            print(cur, a_ls[i])
            cur -= a_ls[i]
        else:
            print(last, cur)
else:
    for i in range(n-1):
        print(last, a_ls[i])
        last -= a_ls[i]