def main():
    n = int(input())
    a = list(map(int, input().split()))
    neg = []
    pos = []
    for v in a:
        if v < 0:
            neg.append(v)
        else:
            pos.append(v)
    ans = []
    neg.sort()
    x, y = 0, len(neg)-1
    if len(pos) == 0:
        ans.append([neg[y], neg[x]])
        p = neg[y] - neg[x]
        pos.append(p)
        x += 1
        y -= 1
    for i in range(x, y):
        ans.append([pos[0], neg[i]])
        pos[0] -= neg[i]
    if y-x+1 > 0:
        pos.append(neg[y])
    pos.sort()
    for i in range(len(pos)-2):
        ans.append([pos[i], pos[i+1]])
        pos[i+1] = pos[i] - pos[i+1]
    if len(pos) > 1:
        ans.append([pos[len(pos)-1], pos[len(pos)-2]])
        pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2]
    print(pos[len(pos)-1])
    for p, q in ans:
        print(p, q)

if __name__ == "__main__":
    main() def main():
    n = int(input())
    a = list(map(int, input().split()))
    neg = []
    pos = []
    for v in a:
        if v < 0:
            neg.append(v)
        else:
            pos.append(v)
    ans = []
    neg.sort()
    x, y = 0, len(neg)-1
    if len(pos) == 0:
        ans.append([neg[y], neg[x]])
        p = neg[y] - neg[x]
        pos.append(p)
        x += 1
        y -= 1
    for i in range(x, y):
        ans.append([pos[0], neg[i]])
        pos[0] -= neg[i]
    if y-x+1 > 0:
        pos.append(neg[y])
    pos.sort()
    for i in range(len(pos)-2):
        ans.append([pos[i], pos[i+1]])
        pos[i+1] = pos[i] - pos[i+1]
    if len(pos) > 1:
        ans.append([pos[len(pos)-1], pos[len(pos)-2]])
        pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2]
    print(pos[len(pos)-1])
    for p, q in ans:
        print(p, q) 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 neg = [] neg [] pos = [] pos [] for v in a:
        if v < 0:
            neg.append(v)
        else:
            pos.append(v)
     v a if v < 0:
            neg.append(v)
        else:
            pos.append(v)
     v < 0 v 0 neg.append(v) neg.append neg append v pos.append(v) pos.append pos append v ans = [] ans [] neg.sort() neg.sort neg sort x, y = 0, len(neg)-1 x 0 y len(neg)-1 len(neg) len neg 1 if len(pos) == 0:
        ans.append([neg[y], neg[x]])
        p = neg[y] - neg[x]
        pos.append(p)
        x += 1
        y -= 1
     len(pos) == 0 len(pos) len pos 0 ans.append([neg[y], neg[x]]) ans.append ans append [neg[y], neg[x]] neg[y] neg y neg[x] neg x p = neg[y] - neg[x] p neg[y] - neg[x] neg[y] neg y neg[x] neg x pos.append(p) pos.append pos append p x += 1 x 1 y -= 1 y 1 for i in range(x, y):
        ans.append([pos[0], neg[i]])
        pos[0] -= neg[i]
     i range(x, y) range x y ans.append([pos[0], neg[i]]) ans.append ans append [pos[0], neg[i]] pos[0] pos 0 neg[i] neg i pos[0] -= neg[i] pos[0] pos 0 neg[i] neg i if y-x+1 > 0:
        pos.append(neg[y])
     y-x+1 > 0 y-x+1 y-x y x 1 0 pos.append(neg[y]) pos.append pos append neg[y] neg y pos.sort() pos.sort pos sort for i in range(len(pos)-2):
        ans.append([pos[i], pos[i+1]])
        pos[i+1] = pos[i] - pos[i+1]
     i range(len(pos)-2) range len(pos)-2 len(pos) len pos 2 ans.append([pos[i], pos[i+1]]) ans.append ans append [pos[i], pos[i+1]] pos[i] pos i pos[i+1] pos i+1 i 1 pos[i+1] = pos[i] - pos[i+1] pos[i+1] pos i+1 i 1 pos[i] - pos[i+1] pos[i] pos i pos[i+1] pos i+1 i 1 if len(pos) > 1:
        ans.append([pos[len(pos)-1], pos[len(pos)-2]])
        pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2]
     len(pos) > 1 len(pos) len pos 1 ans.append([pos[len(pos)-1], pos[len(pos)-2]]) ans.append ans append [pos[len(pos)-1], pos[len(pos)-2]] pos[len(pos)-1] pos len(pos)-1 len(pos) len pos 1 pos[len(pos)-2] pos len(pos)-2 len(pos) len pos 2 pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2] pos[len(pos)-1] pos len(pos)-1 len(pos) len pos 1 pos[len(pos)-1] - pos[len(pos)-2] pos[len(pos)-1] pos len(pos)-1 len(pos) len pos 1 pos[len(pos)-2] pos len(pos)-2 len(pos) len pos 2 print(pos[len(pos)-1]) print pos[len(pos)-1] pos len(pos)-1 len(pos) len pos 1 for p, q in ans:
        print(p, q) p q ans print(p, q) print p q if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    n = int(input())
    a = list(map(int, input().split()))
    neg = []
    pos = []
    for v in a:
        if v < 0:
            neg.append(v)
        else:
            pos.append(v)
    ans = []
    neg.sort()
    x, y = 0, len(neg)-1
    if len(pos) == 0:
        ans.append([neg[y], neg[x]])
        p = neg[y] - neg[x]
        pos.append(p)
        x += 1
        y -= 1
    for i in range(x, y):
        ans.append([pos[0], neg[i]])
        pos[0] -= neg[i]
    if y-x+1 > 0:
        pos.append(neg[y])
    pos.sort()
    for i in range(len(pos)-2):
        ans.append([pos[i], pos[i+1]])
        pos[i+1] = pos[i] - pos[i+1]
    if len(pos) > 1:
        ans.append([pos[len(pos)-1], pos[len(pos)-2]])
        pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2]
    print(pos[len(pos)-1])
    for p, q in ans:
        print(p, q) def main():
    n = int(input())
    a = list(map(int, input().split()))
    neg = []
    pos = []
    for v in a:
        if v < 0:
            neg.append(v)
        else:
            pos.append(v)
    ans = []
    neg.sort()
    x, y = 0, len(neg)-1
    if len(pos) == 0:
        ans.append([neg[y], neg[x]])
        p = neg[y] - neg[x]
        pos.append(p)
        x += 1
        y -= 1
    for i in range(x, y):
        ans.append([pos[0], neg[i]])
        pos[0] -= neg[i]
    if y-x+1 > 0:
        pos.append(neg[y])
    pos.sort()
    for i in range(len(pos)-2):
        ans.append([pos[i], pos[i+1]])
        pos[i+1] = pos[i] - pos[i+1]
    if len(pos) > 1:
        ans.append([pos[len(pos)-1], pos[len(pos)-2]])
        pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2]
    print(pos[len(pos)-1])
    for p, q in ans:
        print(p, q) main
def main():
    n = int(input())
    a = list(map(int, input().split()))
    neg = []
    pos = []
    for v in a:
        if v < 0:
            neg.append(v)
        else:
            pos.append(v)
    ans = []
    neg.sort()
    x, y = 0, len(neg)-1
    if len(pos) == 0:
        ans.append([neg[y], neg[x]])
        p = neg[y] - neg[x]
        pos.append(p)
        x += 1
        y -= 1
    for i in range(x, y):
        ans.append([pos[0], neg[i]])
        pos[0] -= neg[i]
    if y-x+1 > 0:
        pos.append(neg[y])
    pos.sort()
    for i in range(len(pos)-2):
        ans.append([pos[i], pos[i+1]])
        pos[i+1] = pos[i] - pos[i+1]
    if len(pos) > 1:
        ans.append([pos[len(pos)-1], pos[len(pos)-2]])
        pos[len(pos)-1] = pos[len(pos)-1] - pos[len(pos)-2]
    print(pos[len(pos)-1])
    for p, q in ans:
        print(p, q)

if __name__ == "__main__":
    main()
