n = int(eval(input()))

al = list(map(int, input().split()))



if n==2:

    print((max(al)-min(al)))

    print((max(al),min(al)))

    exit()



pos = []

neg = []

for a in al:

    if a>=0:

        pos.append(a)

    else:

        neg.append(a)



pos.sort()

neg.sort(reverse=True)

res = []



if len(pos)==0:

    x = neg[0]

    for a in neg[1:]:

        res.append((x,a))

        x -= a

elif len(neg)==0:

    x = pos[0]

    for a in pos[1:-1]:

        res.append((x,a))

        x -= a

    res.append((pos[-1],x))

    x = pos[-1]-x

else:

    p = pos[0]

    pos = pos[1:]



    x = neg[0]

    neg = neg[1:]



    for a in pos:

        res.append((x,a))

        x -= a

    res.append((p,x))

    x = p - x

    for a in neg:

        res.append((x,a))

        x -= a





print(x)

for a,b in res:

    print((a,b))
n = int(eval(input()))

al = list(map(int, input().split()))

al.sort()



if n==2:

    print((al[1]-al[0]))

    print((al[1],al[0]))

    exit()



res = []

neg = []

pos = []

for a in al:

    if a>=0:

        pos.append(a)

    else:

        neg.append(a)



if len(pos)==0:

    res.append((neg[-1],neg[-2]))

    pos.append(neg[-1]-neg[-2])

    neg = neg[:-2]

if len(neg)==0:

    res.append((pos[0],pos[1]))

    neg.append(pos[0]-pos[1])

    pos = pos[2:]





# len(pos)>0 and len(neg)>0

n = neg[0]

for i in range(1,len(pos)):

    res.append((n,pos[i]))

    n = n - pos[i]

p = pos[0]

for i in range(1,len(neg)):

    res.append((p,neg[i]))

    p = p - neg[i]

res.append((p,n))

print((p-n))

for x,y in res:

    print((x,y))
n = int(eval(input()))
al = list(map(int, input().split()))
if n == 2:
    print((max(al) - min(al)))
    print((max(al), min(al)))
    exit()
pos = []
neg = []
for a in al:
    if a >= 0:
        pos.append(a)
    else:
        neg.append(a)
pos.sort()
neg.sort(reverse=True)
res = []
if len(pos) == 0:
    x = neg[0]
    for a in neg[1:]:
        res.append((x, a))
        x -= a
elif len(neg) == 0:
    x = pos[0]
    for a in pos[1:-1]:
        res.append((x, a))
        x -= a
    res.append((pos[-1], x))
    x = pos[-1] - x
else:
    p = pos[0]
    pos = pos[1:]
    x = neg[0]
    neg = neg[1:]
    for a in pos:
        res.append((x, a))
        x -= a
    res.append((p, x))
    x = p - x
    for a in neg:
        res.append((x, a))
        x -= a
print(x)
for a, b in res:
    print((a, b))

n = int(eval(input()))
al = list(map(int, input().split()))
al.sort()
if n == 2:
    print((al[1] - al[0]))
    print((al[1], al[0]))
    exit()
res = []
neg = []
pos = []
for a in al:
    if a >= 0:
        pos.append(a)
    else:
        neg.append(a)
if len(pos) == 0:
    res.append((neg[-1], neg[-2]))
    pos.append(neg[-1] - neg[-2])
    neg = neg[:-2]
if len(neg) == 0:
    res.append((pos[0], pos[1]))
    neg.append(pos[0] - pos[1])
    pos = pos[2:]
# len(pos)>0 and len(neg)>0
n = neg[0]
for i in range(1, len(pos)):
    res.append((n, pos[i]))
    n = n - pos[i]
p = pos[0]
for i in range(1, len(neg)):
    res.append((p, neg[i]))
    p = p - neg[i]
res.append((p, n))
print((p - n))
for x, y in res:
    print((x, y))

+al.sort() -    print((max(al) - min(al))) -    print((max(al), min(al))) +    print((al[1] - al[0])) +    print((al[1], al[0])) +res = [] +neg = [] -neg = [] -pos.sort() -neg.sort(reverse=True) -res = [] -    x = neg[0] -    for a in neg[1:]: -        res.append((x, a)) -        x -= a -elif len(neg) == 0: -    x = pos[0] -    for a in pos[1:-1]: -        res.append((x, a)) -        x -= a -    res.append((pos[-1], x)) -    x = pos[-1] - x -else: -    p = pos[0] -    pos = pos[1:] -    x = neg[0] -    neg = neg[1:] -    for a in pos: -        res.append((x, a)) -        x -= a -    res.append((p, x)) -    x = p - x -    for a in neg: -        res.append((x, a)) -        x -= a -print(x) -for a, b in res: -    print((a, b)) +    res.append((neg[-1], neg[-2])) +    pos.append(neg[-1] - neg[-2]) +    neg = neg[:-2] +if len(neg) == 0: +    res.append((pos[0], pos[1])) +    neg.append(pos[0] - pos[1]) +    pos = pos[2:] +# len(pos)>0 and len(neg)>0 +n = neg[0] +for i in range(1, len(pos)): +    res.append((n, pos[i])) +    n = n - pos[i] +p = pos[0] +for i in range(1, len(neg)): +    res.append((p, neg[i])) +    p = p - neg[i] +res.append((p, n)) +print((p - n)) +for x, y in res: +    print((x, y))