
# -*- coding: utf-8 -*-
# @Date    : 2019-06-15 20:23:26
# @Author  : raj lath (oorja.halt@gmail.com)
# @Link    : link
# @Version : 1.0.0

import sys
sys.setrecursionlimit(10**5+1)

inf     =  int(10 ** 20)
max_val =  inf
min_val = -inf

RW  = lambda : sys.stdin.readline().strip()
RI  = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]


nb_elem = RI()
elements = sorted(RMI())
mins = elements[0]
maxs = elements[-1]
ans = []
for e in elements[1:-1]:
    if e > 0:
        ans.append([mins, e])
        mins -= e
    else:
        ans.append([maxs, e])
        maxs -= e
ans.append([maxs, mins])
print(maxs - mins)
for i in ans:
    print(*i) import sys sys sys.setrecursionlimit(10**5+1) sys.setrecursionlimit sys setrecursionlimit 10**5+1 10**5 10 5 1 inf     =  int(10 ** 20) inf int(10 ** 20) int 10 ** 20 10 20 max_val =  inf max_val inf min_val = -inf min_val -inf inf RW  = lambda : sys.stdin.readline().strip() RW lambda : sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip RI  = lambda : int(RW()) RI lambda : int(RW()) int(RW()) int RW() RW int(x) for x in sys.stdin.readline().strip().split() for x in sys.stdin.readline().strip().split() x sys.stdin.readline().strip().split() sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split for x in sys.stdin.readline().strip().split() int(x) int x RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()] RMI lambda : [int(x) for x in sys.stdin.readline().strip().split()] [int(x) for x in sys.stdin.readline().strip().split()] x for x in sys.stdin.readline().strip().split() for x in sys.stdin.readline().strip().split() x sys.stdin.readline().strip().split() sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split for x in sys.stdin.readline().strip().split() x RWI = lambda : [x for x in sys.stdin.readline().strip().split()] RWI lambda : [x for x in sys.stdin.readline().strip().split()] [x for x in sys.stdin.readline().strip().split()] nb_elem = RI() nb_elem RI() RI elements = sorted(RMI()) elements sorted(RMI()) sorted RMI() RMI mins = elements[0] mins elements[0] elements 0 maxs = elements[-1] maxs elements[-1] elements -1 ans = [] ans [] for e in elements[1:-1]:
    if e > 0:
        ans.append([mins, e])
        mins -= e
    else:
        ans.append([maxs, e])
        maxs -= e e elements[1:-1] elements 1:-1 1 -1 if e > 0:
        ans.append([mins, e])
        mins -= e
    else:
        ans.append([maxs, e])
        maxs -= e e > 0 e 0 ans.append([mins, e]) ans.append ans append [mins, e] mins e mins -= e mins e ans.append([maxs, e]) ans.append ans append [maxs, e] maxs e maxs -= e maxs e ans.append([maxs, mins]) ans.append ans append [maxs, mins] maxs mins print(maxs - mins) print maxs - mins maxs mins for i in ans:
    print(*i) i ans print(*i) print *i i RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()] lambda : [int(x) for x in sys.stdin.readline().strip().split()] RMI mins = elements[0] elements[0] mins mins -= e e mins max_val =  inf inf max_val RWI = lambda : [x for x in sys.stdin.readline().strip().split()] lambda : [x for x in sys.stdin.readline().strip().split()] RWI maxs -= e e maxs min_val = -inf -inf min_val nb_elem = RI() RI() nb_elem RI  = lambda : int(RW()) lambda : int(RW()) RI elements = sorted(RMI()) sorted(RMI()) elements ans = [] [] ans inf     =  int(10 ** 20) int(10 ** 20) inf maxs = elements[-1] elements[-1] maxs RW  = lambda : sys.stdin.readline().strip() lambda : sys.stdin.readline().strip() RW

# -*- coding: utf-8 -*-
# @Date    : 2019-06-15 20:23:26
# @Author  : raj lath (oorja.halt@gmail.com)
# @Link    : link
# @Version : 1.0.0

import sys
sys.setrecursionlimit(10**5+1)

inf     =  int(10 ** 20)
max_val =  inf
min_val = -inf

RW  = lambda : sys.stdin.readline().strip()
RI  = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]


nb_elem = RI()
elements = sorted(RMI())
mins = elements[0]
maxs = elements[-1]
ans = []
for e in elements[1:-1]:
    if e > 0:
        ans.append([mins, e])
        mins -= e
    else:
        ans.append([maxs, e])
        maxs -= e
ans.append([maxs, mins])
print(maxs - mins)
for i in ans:
    print(*i)