import sys
import collections as col
import bisect
import numpy as np


def main():
    n = int(input())
    aarray = [int(e) for e in input().split()]
    aarray.sort()
    record = []
    endpoint = max(1, bisect.bisect(aarray, 0))
    aqueue = col.deque(aarray)
    while len(aqueue) > endpoint + 1:
        amax = aqueue.pop()
        amin = aqueue.popleft()
        record.append((amin, amax))
        aqueue.appendleft(amin - amax)
    amax = aqueue.pop()
    while len(aqueue) > 0:
        amin = aqueue.popleft()
        record.append((amax, amin))
        amax -= amin
    print(amax)
    for r in record:
        print(r[0], r[1])


main() import sys sys import collections as col collections import bisect bisect import numpy as np numpy def main():
    n = int(input())
    aarray = [int(e) for e in input().split()]
    aarray.sort()
    record = []
    endpoint = max(1, bisect.bisect(aarray, 0))
    aqueue = col.deque(aarray)
    while len(aqueue) > endpoint + 1:
        amax = aqueue.pop()
        amin = aqueue.popleft()
        record.append((amin, amax))
        aqueue.appendleft(amin - amax)
    amax = aqueue.pop()
    while len(aqueue) > 0:
        amin = aqueue.popleft()
        record.append((amax, amin))
        amax -= amin
    print(amax)
    for r in record:
        print(r[0], r[1]) main n = int(input()) n int(input()) int input() input int(e) for e in input().split() for e in input().split() e input().split() ().split () input split for e in input().split() int(e) int e aarray = [int(e) for e in input().split()] aarray [int(e) for e in input().split()] aarray.sort() aarray.sort aarray sort record = [] record [] endpoint = max(1, bisect.bisect(aarray, 0)) endpoint max(1, bisect.bisect(aarray, 0)) max 1 bisect.bisect(aarray, 0) bisect.bisect bisect bisect aarray 0 aqueue = col.deque(aarray) aqueue col.deque(aarray) col.deque col deque aarray while len(aqueue) > endpoint + 1:
        amax = aqueue.pop()
        amin = aqueue.popleft()
        record.append((amin, amax))
        aqueue.appendleft(amin - amax)
     len(aqueue) > endpoint + 1 len(aqueue) len aqueue endpoint + 1 endpoint 1 amax = aqueue.pop() amax aqueue.pop() aqueue.pop aqueue pop amin = aqueue.popleft() amin aqueue.popleft() aqueue.popleft aqueue popleft record.append((amin, amax)) record.append record append (amin, amax) amin amax aqueue.appendleft(amin - amax) aqueue.appendleft aqueue appendleft amin - amax amin amax amax = aqueue.pop() amax aqueue.pop() aqueue.pop aqueue pop while len(aqueue) > 0:
        amin = aqueue.popleft()
        record.append((amax, amin))
        amax -= amin
     len(aqueue) > 0 len(aqueue) len aqueue 0 amin = aqueue.popleft() amin aqueue.popleft() aqueue.popleft aqueue popleft record.append((amax, amin)) record.append record append (amax, amin) amax amin amax -= amin amax amin print(amax) print amax for r in record:
        print(r[0], r[1]) r record print(r[0], r[1]) print r[0] r 0 r[1] r 1 main() main def main():
    n = int(input())
    aarray = [int(e) for e in input().split()]
    aarray.sort()
    record = []
    endpoint = max(1, bisect.bisect(aarray, 0))
    aqueue = col.deque(aarray)
    while len(aqueue) > endpoint + 1:
        amax = aqueue.pop()
        amin = aqueue.popleft()
        record.append((amin, amax))
        aqueue.appendleft(amin - amax)
    amax = aqueue.pop()
    while len(aqueue) > 0:
        amin = aqueue.popleft()
        record.append((amax, amin))
        amax -= amin
    print(amax)
    for r in record:
        print(r[0], r[1]) def main():
    n = int(input())
    aarray = [int(e) for e in input().split()]
    aarray.sort()
    record = []
    endpoint = max(1, bisect.bisect(aarray, 0))
    aqueue = col.deque(aarray)
    while len(aqueue) > endpoint + 1:
        amax = aqueue.pop()
        amin = aqueue.popleft()
        record.append((amin, amax))
        aqueue.appendleft(amin - amax)
    amax = aqueue.pop()
    while len(aqueue) > 0:
        amin = aqueue.popleft()
        record.append((amax, amin))
        amax -= amin
    print(amax)
    for r in record:
        print(r[0], r[1]) main
import sys
import collections as col
import bisect
import numpy as np


def main():
    n = int(input())
    aarray = [int(e) for e in input().split()]
    aarray.sort()
    record = []
    endpoint = max(1, bisect.bisect(aarray, 0))
    aqueue = col.deque(aarray)
    while len(aqueue) > endpoint + 1:
        amax = aqueue.pop()
        amin = aqueue.popleft()
        record.append((amin, amax))
        aqueue.appendleft(amin - amax)
    amax = aqueue.pop()
    while len(aqueue) > 0:
        amin = aqueue.popleft()
        record.append((amax, amin))
        amax -= amin
    print(amax)
    for r in record:
        print(r[0], r[1])


main()
