import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = sorted(LI())
    i = 0
    if a[0] >= 0:
        i = 0
    elif a[-1] <= 0:
        i = n - 2
    else:
        i = bisect.bisect_right(a,0) - 1

    r = []
    j = i + 1
    # print(a,i,j)
    for k in range(i-1,-1,-1):
        r.append('{} {}'.format(a[j], a[k]))
        a[j] -= a[k]
    for k in range(j+1,n):
        r.append('{} {}'.format(a[i], a[k]))
        a[i] -= a[k]
    r.append('{} {}'.format(a[j],a[i]))

    return '{}\n{}'.format(a[j]-a[i], JA(r, '\n'))


print(main())
 import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools math string itertools fractions heapq collections re array bisect sys copy functools sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 inf = 10**20 inf 10**20 10 20 eps = 1.0 / 10**10 eps 1.0 / 10**10 1.0 10**10 10 10 mod = 998244353 mod 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] dd [(-1,0),(0,1),(1,0),(0,-1)] (-1,0) -1 0 (0,1) 0 1 (1,0) 1 0 (0,-1) 0 -1 ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] ddn [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] (-1,0) -1 0 (-1,1) -1 1 (0,1) 0 1 (1,1) 1 1 (1,0) 1 0 (1,-1) 1 -1 (0,-1) 0 -1 (-1,-1) -1 -1 def LI(): return list(map(int, sys.stdin.readline().split())) LI list(map(int, l.split())) for l in sys.stdin.readlines() for l in sys.stdin.readlines() l sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines for l in sys.stdin.readlines() list(map(int, l.split())) list map(int, l.split()) map int l.split() l.split l split def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] LLI int(x)-1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ float(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) F def S(): return input() S def pf(s): return print(s, flush=True) pf s s def pe(s): return print(str(s), file=sys.stderr) pe s s def JA(a, sep): return sep.join(map(str, a)) JA a a sep sep def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) JAA a a s s t t def main():
    n = I()
    a = sorted(LI())
    i = 0
    if a[0] >= 0:
        i = 0
    elif a[-1] <= 0:
        i = n - 2
    else:
        i = bisect.bisect_right(a,0) - 1

    r = []
    j = i + 1
    # print(a,i,j)
    for k in range(i-1,-1,-1):
        r.append('{} {}'.format(a[j], a[k]))
        a[j] -= a[k]
    for k in range(j+1,n):
        r.append('{} {}'.format(a[i], a[k]))
        a[i] -= a[k]
    r.append('{} {}'.format(a[j],a[i]))

    return '{}\n{}'.format(a[j]-a[i], JA(r, '\n')) main n = I() n I() I a = sorted(LI()) a sorted(LI()) sorted LI() LI i = 0 i 0 if a[0] >= 0:
        i = 0
    elif a[-1] <= 0:
        i = n - 2
    else:
        i = bisect.bisect_right(a,0) - 1

     a[0] >= 0 a[0] a 0 0 i = 0 i 0 elif a[-1] <= 0:
        i = n - 2
     a[-1] <= 0 a[-1] a -1 0 i = n - 2 i n - 2 n 2 i = bisect.bisect_right(a,0) - 1 i bisect.bisect_right(a,0) - 1 bisect.bisect_right(a,0) bisect.bisect_right bisect bisect_right a 0 1 r = [] r [] j = i + 1 j i + 1 i 1 for k in range(i-1,-1,-1):
        r.append('{} {}'.format(a[j], a[k]))
        a[j] -= a[k]
     k range(i-1,-1,-1) range i-1 i 1 -1 -1 r.append('{} {}'.format(a[j], a[k])) r.append r append '{} {}'.format(a[j], a[k]) '{} {}'.format '{} {}' format a[j] a j a[k] a k a[j] -= a[k] a[j] a j a[k] a k for k in range(j+1,n):
        r.append('{} {}'.format(a[i], a[k]))
        a[i] -= a[k]
     k range(j+1,n) range j+1 j 1 n r.append('{} {}'.format(a[i], a[k])) r.append r append '{} {}'.format(a[i], a[k]) '{} {}'.format '{} {}' format a[i] a i a[k] a k a[i] -= a[k] a[i] a i a[k] a k r.append('{} {}'.format(a[j],a[i])) r.append r append '{} {}'.format(a[j],a[i]) '{} {}'.format '{} {}' format a[j] a j a[i] a i return '{}\n{}'.format(a[j]-a[i], JA(r, '\n')) '{}\n{}'.format(a[j]-a[i], JA(r, '\n')) '{}\n{}'.format '{}\n{}' format a[j]-a[i] a[j] a j a[i] a i JA(r, '\n') JA r '\n' print(main()) print main() main def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def JA(a, sep): return sep.join(map(str, a)) def JA(a, sep): return sep.join(map(str, a)) JA def pf(s): return print(s, flush=True) def pf(s): return print(s, flush=True) pf def pe(s): return print(str(s), file=sys.stderr) def pe(s): return print(str(s), file=sys.stderr) pe def main():
    n = I()
    a = sorted(LI())
    i = 0
    if a[0] >= 0:
        i = 0
    elif a[-1] <= 0:
        i = n - 2
    else:
        i = bisect.bisect_right(a,0) - 1

    r = []
    j = i + 1
    # print(a,i,j)
    for k in range(i-1,-1,-1):
        r.append('{} {}'.format(a[j], a[k]))
        a[j] -= a[k]
    for k in range(j+1,n):
        r.append('{} {}'.format(a[i], a[k]))
        a[i] -= a[k]
    r.append('{} {}'.format(a[j],a[i]))

    return '{}\n{}'.format(a[j]-a[i], JA(r, '\n')) def main():
    n = I()
    a = sorted(LI())
    i = 0
    if a[0] >= 0:
        i = 0
    elif a[-1] <= 0:
        i = n - 2
    else:
        i = bisect.bisect_right(a,0) - 1

    r = []
    j = i + 1
    # print(a,i,j)
    for k in range(i-1,-1,-1):
        r.append('{} {}'.format(a[j], a[k]))
        a[j] -= a[k]
    for k in range(j+1,n):
        r.append('{} {}'.format(a[i], a[k]))
        a[i] -= a[k]
    r.append('{} {}'.format(a[j],a[i]))

    return '{}\n{}'.format(a[j]-a[i], JA(r, '\n')) main ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] ddn def S(): return input() def S(): return input() S eps = 1.0 / 10**10 1.0 / 10**10 eps inf = 10**20 10**20 inf def F(): return float(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) F def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a) JAA def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()] LLI def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ mod = 998244353 998244353 mod dd = [(-1,0),(0,1),(1,0),(0,-1)] [(-1,0),(0,1),(1,0),(0,-1)] dd def LI(): return list(map(int, sys.stdin.readline().split())) def LI(): return list(map(int, sys.stdin.readline().split())) LI
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = sorted(LI())
    i = 0
    if a[0] >= 0:
        i = 0
    elif a[-1] <= 0:
        i = n - 2
    else:
        i = bisect.bisect_right(a,0) - 1

    r = []
    j = i + 1
    # print(a,i,j)
    for k in range(i-1,-1,-1):
        r.append('{} {}'.format(a[j], a[k]))
        a[j] -= a[k]
    for k in range(j+1,n):
        r.append('{} {}'.format(a[i], a[k]))
        a[i] -= a[k]
    r.append('{} {}'.format(a[j],a[i]))

    return '{}\n{}'.format(a[j]-a[i], JA(r, '\n'))


print(main())

