There are N integers, A_1, A_2, ..., A_N, written on a blackboard.  We will repeat the following operation N-1 times so that we have only one integer on the blackboard.    * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.  Find the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.
n=int(input())
a=list(map(int,input().split()))
ans=[]
for i in range(n-1):
    a.sort()
    num=a.pop()
    num2=a.pop(0)
    if i%2:
        ans.append((num,num2))
        a.append(num-num2)
    else:
        ans.append((num2,num))
        a.append(num2-num)
print(a[0])
for num,num2 in ans:
    print(num,num2)

n=int(input())
a=list(map(int,input().split()))
a.sort()
min=a[0]
max=a[-1]
ans=[]
for a in a[1:-1]:
    if a>0:
        ans.append([min,a])
        min-=a
    else:
        ans.append([max,a])
        max-=a
ans.append([max,min])
print(max-min)
for x,y in ans:
    print(x,y)