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

a.sort()

def answer():
    p = sum(1 for i in a if i < 0)
    q = sum(1 for i in a if i >= 0)

    if p == 0:
        p += 1
        q -= 1
    if q == 0:
        p -= 1
        q += 1

    list_xy = []
    for i in range(q - 1):
        list_xy.append((a[0], a[p + i]))
        a[0] -= a[p + i]
    for i in range(p):
        list_xy.append((a[-1], a[i]))
        a[-1] -= a[i]
    return a[-1], list_xy


m, list_xy = answer()

print(m)
for x, y in list_xy:
    print(x, y) 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 def answer():
    p = sum(1 for i in a if i < 0)
    q = sum(1 for i in a if i >= 0)

    if p == 0:
        p += 1
        q -= 1
    if q == 0:
        p -= 1
        q += 1

    list_xy = []
    for i in range(q - 1):
        list_xy.append((a[0], a[p + i]))
        a[0] -= a[p + i]
    for i in range(p):
        list_xy.append((a[-1], a[i]))
        a[-1] -= a[i]
    return a[-1], list_xy answer p = sum(1 for i in a if i < 0) p sum(1 for i in a if i < 0) sum 1 q = sum(1 for i in a if i >= 0) q sum(1 for i in a if i >= 0) sum 1 if p == 0:
        p += 1
        q -= 1
     p == 0 p 0 p += 1 p 1 q -= 1 q 1 if q == 0:
        p -= 1
        q += 1

     q == 0 q 0 p -= 1 p 1 q += 1 q 1 list_xy = [] list_xy [] for i in range(q - 1):
        list_xy.append((a[0], a[p + i]))
        a[0] -= a[p + i]
     i range(q - 1) range q - 1 q 1 list_xy.append((a[0], a[p + i])) list_xy.append list_xy append (a[0], a[p + i]) a[0] a 0 a[p + i] a p + i p i a[0] -= a[p + i] a[0] a 0 a[p + i] a p + i p i for i in range(p):
        list_xy.append((a[-1], a[i]))
        a[-1] -= a[i]
     i range(p) range p list_xy.append((a[-1], a[i])) list_xy.append list_xy 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 return a[-1], list_xy return a[-1], list_xy a[-1] a -1 list_xy m, list_xy = answer() m answer() answer list_xy print(m) print m for x, y in list_xy:
    print(x, y) x y list_xy print(x, y) print x y m, list_xy = answer() answer() m a = list(map(int, input().split())) list(map(int, input().split())) a list_xy = answer() answer() list_xy n = int(input()) int(input()) n def answer():
    p = sum(1 for i in a if i < 0)
    q = sum(1 for i in a if i >= 0)

    if p == 0:
        p += 1
        q -= 1
    if q == 0:
        p -= 1
        q += 1

    list_xy = []
    for i in range(q - 1):
        list_xy.append((a[0], a[p + i]))
        a[0] -= a[p + i]
    for i in range(p):
        list_xy.append((a[-1], a[i]))
        a[-1] -= a[i]
    return a[-1], list_xy def answer():
    p = sum(1 for i in a if i < 0)
    q = sum(1 for i in a if i >= 0)

    if p == 0:
        p += 1
        q -= 1
    if q == 0:
        p -= 1
        q += 1

    list_xy = []
    for i in range(q - 1):
        list_xy.append((a[0], a[p + i]))
        a[0] -= a[p + i]
    for i in range(p):
        list_xy.append((a[-1], a[i]))
        a[-1] -= a[i]
    return a[-1], list_xy answer
n = int(input())
a = list(map(int, input().split()))

a.sort()

def answer():
    p = sum(1 for i in a if i < 0)
    q = sum(1 for i in a if i >= 0)

    if p == 0:
        p += 1
        q -= 1
    if q == 0:
        p -= 1
        q += 1

    list_xy = []
    for i in range(q - 1):
        list_xy.append((a[0], a[p + i]))
        a[0] -= a[p + i]
    for i in range(p):
        list_xy.append((a[-1], a[i]))
        a[-1] -= a[i]
    return a[-1], list_xy


m, list_xy = answer()

print(m)
for x, y in list_xy:
    print(x, y)
