def main():

    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    
    if A[-1] < 0:
        maxv = -sum(A) + 2 * A[-1]
        cur = A[-1]
        ops = []
        for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
    elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
    else:
        pos = []
        neg = []
        for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
        maxv = sum(pos) - sum(neg)
        ops = []
        cur = neg[0]
        for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
        ops.append([pos[-1], cur])
        cur = pos[-1] - cur
        for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

    return maxv, ops

if __name__ == '__main__':
    output = main()
    print(output[0])
    for a, b in output[1]:
        print(" ".join(map(str, [a, b]))) def main():

    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    
    if A[-1] < 0:
        maxv = -sum(A) + 2 * A[-1]
        cur = A[-1]
        ops = []
        for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
    elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
    else:
        pos = []
        neg = []
        for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
        maxv = sum(pos) - sum(neg)
        ops = []
        cur = neg[0]
        for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
        ops.append([pos[-1], cur])
        cur = pos[-1] - cur
        for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

    return maxv, ops 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 if A[-1] < 0:
        maxv = -sum(A) + 2 * A[-1]
        cur = A[-1]
        ops = []
        for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
    elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
    else:
        pos = []
        neg = []
        for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
        maxv = sum(pos) - sum(neg)
        ops = []
        cur = neg[0]
        for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
        ops.append([pos[-1], cur])
        cur = pos[-1] - cur
        for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

     A[-1] < 0 A[-1] A -1 0 maxv = -sum(A) + 2 * A[-1] maxv -sum(A) + 2 * A[-1] -sum(A) sum(A) sum A 2 * A[-1] 2 A[-1] A -1 cur = A[-1] cur A[-1] A -1 ops = [] ops [] for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
     i range(N-1) range N-1 N 1 ops.append([cur, A[i]]) ops.append ops append [cur, A[i]] cur A[i] A i cur -= A[i] cur A[i] A i elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
     A[0] >= 0 A[0] A 0 0 maxv = sum(A)-2*A[0] maxv sum(A)-2*A[0] sum(A) sum A 2*A[0] 2 A[0] A 0 ops = [] ops [] cur = A[0] cur A[0] A 0 for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
         i range(1, N-1) range 1 N-1 N 1 ops.append([cur, A[i]]) ops.append ops append [cur, A[i]] cur A[i] A i cur -= A[i] cur A[i] A i ops.append([A[-1], cur]) ops.append ops append [A[-1], cur] A[-1] A -1 cur pos = [] pos [] neg = [] neg [] for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
         a A if a < 0: neg.append(a)
            else: pos.append(a)
         a < 0 a 0 maxv = sum(pos) - sum(neg) maxv sum(pos) - sum(neg) sum(pos) sum pos sum(neg) sum neg ops = [] ops [] cur = neg[0] cur neg[0] neg 0 for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
         i range(len(pos)-1) range len(pos)-1 len(pos) len pos 1 ops.append([cur, pos[i]]) ops.append ops append [cur, pos[i]] cur pos[i] pos i cur -= pos[i] cur pos[i] pos i ops.append([pos[-1], cur]) ops.append ops append [pos[-1], cur] pos[-1] pos -1 cur cur = pos[-1] - cur cur pos[-1] - cur pos[-1] pos -1 cur for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

     i range(1, len(neg)) range 1 len(neg) len neg ops.append([cur, neg[i]]) ops.append ops append [cur, neg[i]] cur neg[i] neg i cur -= neg[i] cur neg[i] neg i return maxv, ops return maxv, ops maxv ops if __name__ == '__main__':
    output = main()
    print(output[0])
    for a, b in output[1]:
        print(" ".join(map(str, [a, b]))) __name__ == '__main__' __name__ '__main__' output = main() output main() main print(output[0]) print output[0] output 0 for a, b in output[1]:
        print(" ".join(map(str, [a, b]))) a b output[1] output 1 print(" ".join(map(str, [a, b]))) print " ".join(map(str, [a, b])) " ".join " " join map(str, [a, b]) map str [a, b] a b output = main() main() output def main():

    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    
    if A[-1] < 0:
        maxv = -sum(A) + 2 * A[-1]
        cur = A[-1]
        ops = []
        for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
    elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
    else:
        pos = []
        neg = []
        for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
        maxv = sum(pos) - sum(neg)
        ops = []
        cur = neg[0]
        for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
        ops.append([pos[-1], cur])
        cur = pos[-1] - cur
        for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

    return maxv, ops def main():

    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    
    if A[-1] < 0:
        maxv = -sum(A) + 2 * A[-1]
        cur = A[-1]
        ops = []
        for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
    elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
    else:
        pos = []
        neg = []
        for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
        maxv = sum(pos) - sum(neg)
        ops = []
        cur = neg[0]
        for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
        ops.append([pos[-1], cur])
        cur = pos[-1] - cur
        for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

    return maxv, ops main
def main():

    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    
    if A[-1] < 0:
        maxv = -sum(A) + 2 * A[-1]
        cur = A[-1]
        ops = []
        for i in range(N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
    elif A[0] >= 0:
        maxv = sum(A)-2*A[0]
        ops = []
        cur = A[0]
        for i in range(1, N-1):
            ops.append([cur, A[i]])
            cur -= A[i]
        ops.append([A[-1], cur])
    else:
        pos = []
        neg = []
        for a in A:
            if a < 0: neg.append(a)
            else: pos.append(a)
        maxv = sum(pos) - sum(neg)
        ops = []
        cur = neg[0]
        for i in range(len(pos)-1):
            ops.append([cur, pos[i]])
            cur -= pos[i]
        ops.append([pos[-1], cur])
        cur = pos[-1] - cur
        for i in range(1, len(neg)):
            ops.append([cur, neg[i]])
            cur -= neg[i]

    return maxv, ops

if __name__ == '__main__':
    output = main()
    print(output[0])
    for a, b in output[1]:
        print(" ".join(map(str, [a, b])))