#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    s = A[0]
    l = A[-1]
    ret = []
    for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
    print(l-s)
    ret.append((l,s))
    for x, y in ret:
        print(x, y)

if __name__ == '__main__':
    main() def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    s = A[0]
    l = A[-1]
    ret = []
    for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
    print(l-s)
    ret.append((l,s))
    for x, y in ret:
        print(x, y) main 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 s = A[0] s A[0] A 0 l = A[-1] l A[-1] A -1 ret = [] ret [] for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
     a A[1:N-1] A 1:N-1 1 N-1 N 1 if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
     a>=0 a 0 ret.append((s, a)) ret.append ret append (s, a) s a s -= a s a ret.append((l, a)) ret.append ret append (l, a) l a l -= a l a print(l-s) print l-s l s ret.append((l,s)) ret.append ret append (l,s) l s for x, y in ret:
        print(x, y) x y ret print(x, y) print x y if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    s = A[0]
    l = A[-1]
    ret = []
    for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
    print(l-s)
    ret.append((l,s))
    for x, y in ret:
        print(x, y) def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    s = A[0]
    l = A[-1]
    ret = []
    for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
    print(l-s)
    ret.append((l,s))
    for x, y in ret:
        print(x, y) main
#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    s = A[0]
    l = A[-1]
    ret = []
    for a in A[1:N-1]:
        if a>=0:
            ret.append((s, a))
            s -= a
        else:
            ret.append((l, a))
            l -= a
    print(l-s)
    ret.append((l,s))
    for x, y in ret:
        print(x, y)

if __name__ == '__main__':
    main()