n = int(input())
a = sorted(list(map(int,input().split())))
if a[n-1] < 0:
    ans = 2*a[n-1]-sum(a)
    print(ans)
    p,q =a[n-1],a[0]
    for i in range(n-1):
        print(p,q)
        p = p-q
        q = a[i+1]
elif a[0] >= 0:
    ans = sum(a)-2*a[0]
    print(ans)
    p,q = a[0],a[1]
    for i in range(n-2):
        print(p,q)
        p = p-q
        q = a[i+2]
    print(q,p)

else:
    num = 0
    ans = 0
    for i in range(n):
        if a[i] < 0:
            ans -=a[i]
        else:
            if a[i-1] < 0 and a[i] >= 0:
                num = i
            ans += a[i]
    print(ans)
    p = a[0]
    for i in range(num,n-1):
        print(p,a[i])
        p -= a[i]
    q = a[n-1]
    print(q,p)
    q -= p
    for i in range(1,num):
        print(q,a[i])
        q -= a[i] n = int(input()) n int(input()) int input() input a = sorted(list(map(int,input().split()))) a sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split if a[n-1] < 0:
    ans = 2*a[n-1]-sum(a)
    print(ans)
    p,q =a[n-1],a[0]
    for i in range(n-1):
        print(p,q)
        p = p-q
        q = a[i+1]
elif a[0] >= 0:
    ans = sum(a)-2*a[0]
    print(ans)
    p,q = a[0],a[1]
    for i in range(n-2):
        print(p,q)
        p = p-q
        q = a[i+2]
    print(q,p)

else:
    num = 0
    ans = 0
    for i in range(n):
        if a[i] < 0:
            ans -=a[i]
        else:
            if a[i-1] < 0 and a[i] >= 0:
                num = i
            ans += a[i]
    print(ans)
    p = a[0]
    for i in range(num,n-1):
        print(p,a[i])
        p -= a[i]
    q = a[n-1]
    print(q,p)
    q -= p
    for i in range(1,num):
        print(q,a[i])
        q -= a[i] a[n-1] < 0 a[n-1] a n-1 n 1 0 ans = 2*a[n-1]-sum(a) ans 2*a[n-1]-sum(a) 2*a[n-1] 2 a[n-1] a n-1 n 1 sum(a) sum a print(ans) print ans p,q =a[n-1],a[0] p a[n-1] a n-1 n 1 q a[0] a 0 for i in range(n-1):
        print(p,q)
        p = p-q
        q = a[i+1] i range(n-1) range n-1 n 1 print(p,q) print p q p = p-q p p-q p q q = a[i+1] q a[i+1] a i+1 i 1 elif a[0] >= 0:
    ans = sum(a)-2*a[0]
    print(ans)
    p,q = a[0],a[1]
    for i in range(n-2):
        print(p,q)
        p = p-q
        q = a[i+2]
    print(q,p) a[0] >= 0 a[0] a 0 0 ans = sum(a)-2*a[0] ans sum(a)-2*a[0] sum(a) sum a 2*a[0] 2 a[0] a 0 print(ans) print ans p,q = a[0],a[1] p a[0] a 0 q a[1] a 1 for i in range(n-2):
        print(p,q)
        p = p-q
        q = a[i+2]
     i range(n-2) range n-2 n 2 print(p,q) print p q p = p-q p p-q p q q = a[i+2] q a[i+2] a i+2 i 2 print(q,p) print q p num = 0 num 0 ans = 0 ans 0 for i in range(n):
        if a[i] < 0:
            ans -=a[i]
        else:
            if a[i-1] < 0 and a[i] >= 0:
                num = i
            ans += a[i]
     i range(n) range n if a[i] < 0:
            ans -=a[i]
        else:
            if a[i-1] < 0 and a[i] >= 0:
                num = i
            ans += a[i]
     a[i] < 0 a[i] a i 0 ans -=a[i] ans a[i] a i if a[i-1] < 0 and a[i] >= 0:
                num = i
             a[i-1] < 0 and a[i] >= 0 a[i-1] < 0 a[i-1] a i-1 i 1 0 a[i] >= 0 a[i] a i 0 num = i num i ans += a[i] ans a[i] a i print(ans) print ans p = a[0] p a[0] a 0 for i in range(num,n-1):
        print(p,a[i])
        p -= a[i]
     i range(num,n-1) range num n-1 n 1 print(p,a[i]) print p a[i] a i p -= a[i] p a[i] a i q = a[n-1] q a[n-1] a n-1 n 1 print(q,p) print q p q -= p q p for i in range(1,num):
        print(q,a[i])
        q -= a[i] i range(1,num) range 1 num print(q,a[i]) print q a[i] a i q -= a[i] q a[i] a i n = int(input()) int(input()) n a = sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) a ans = 2*a[n-1]-sum(a) 2*a[n-1]-sum(a) ans p,q = a[0],a[1] a[0] p q =a[n-1],a[0] a[0] q num = 0 0 num q = a[0],a[1] a[1] q q = a[i+1] a[i+1] q p = p-q p-q p p,q =a[n-1],a[0] a[n-1] p p = p-q p-q p p = a[0] a[0] p p -= a[i] a[i] p q -= p p q ans = sum(a)-2*a[0] sum(a)-2*a[0] ans q = a[n-1] a[n-1] q q -= a[i] a[i] q ans = 0 0 ans q = a[i+2] a[i+2] q ans += a[i] a[i] ans ans -=a[i] a[i] ans num = i i num
n = int(input())
a = sorted(list(map(int,input().split())))
if a[n-1] < 0:
    ans = 2*a[n-1]-sum(a)
    print(ans)
    p,q =a[n-1],a[0]
    for i in range(n-1):
        print(p,q)
        p = p-q
        q = a[i+1]
elif a[0] >= 0:
    ans = sum(a)-2*a[0]
    print(ans)
    p,q = a[0],a[1]
    for i in range(n-2):
        print(p,q)
        p = p-q
        q = a[i+2]
    print(q,p)

else:
    num = 0
    ans = 0
    for i in range(n):
        if a[i] < 0:
            ans -=a[i]
        else:
            if a[i-1] < 0 and a[i] >= 0:
                num = i
            ans += a[i]
    print(ans)
    p = a[0]
    for i in range(num,n-1):
        print(p,a[i])
        p -= a[i]
    q = a[n-1]
    print(q,p)
    q -= p
    for i in range(1,num):
        print(q,a[i])
        q -= a[i]