n = int(input())
a = input().split()
for i in range(len(a)):
    a[i]=int(a[i])
# print(a)
a.sort()
# print(a)
# #両端をとっておく
hashi1 = a[0]
hashi2 = a[-1]
a.remove(a[0])
a.remove(a[-1])
# print(a)
minus_list = []
plus_list = []
printlist = []
for i in range(len(a)):
    if a[i]>0:
        plus_list.append(a[i])
    else:
        minus_list.append(a[i])
# print(minus_list)
# print(plus_list)
for j in range(len(minus_list)):
    printlist.append(hashi2)
    printlist.append(minus_list[j])
    hashi2 = hashi2-minus_list[j]
    
for l in range(len(plus_list)):
    printlist.append(hashi1)
    printlist.append(plus_list[l])
    hashi1 = hashi1 - plus_list[l]
    
printlist.append(hashi2)
printlist.append(hashi1)
print(hashi2-hashi1)
# print(printlist)
for n in range(0,len(printlist),2):
    print(printlist[n],printlist[n+1]) n = int(input()) n int(input()) int input() input a = input().split() a input().split() ().split () input split for i in range(len(a)):
    a[i]=int(a[i])
# print(a) i range(len(a)) range len(a) len a a[i]=int(a[i]) a[i] a i int(a[i]) int a[i] a i a.sort() a.sort a sort hashi1 = a[0] hashi1 a[0] a 0 hashi2 = a[-1] hashi2 a[-1] a -1 a.remove(a[0]) a.remove a remove a[0] a 0 a.remove(a[-1]) a.remove a remove a[-1] a -1 minus_list = [] minus_list [] plus_list = [] plus_list [] printlist = [] printlist [] for i in range(len(a)):
    if a[i]>0:
        plus_list.append(a[i])
    else:
        minus_list.append(a[i])
# print(minus_list)
# print(plus_list) i range(len(a)) range len(a) len a if a[i]>0:
        plus_list.append(a[i])
    else:
        minus_list.append(a[i])
# print(minus_list)
# print(plus_list) a[i]>0 a[i] a i 0 plus_list.append(a[i]) plus_list.append plus_list append a[i] a i minus_list.append(a[i]) minus_list.append minus_list append a[i] a i for j in range(len(minus_list)):
    printlist.append(hashi2)
    printlist.append(minus_list[j])
    hashi2 = hashi2-minus_list[j]
     j range(len(minus_list)) range len(minus_list) len minus_list printlist.append(hashi2) printlist.append printlist append hashi2 printlist.append(minus_list[j]) printlist.append printlist append minus_list[j] minus_list j hashi2 = hashi2-minus_list[j] hashi2 hashi2-minus_list[j] hashi2 minus_list[j] minus_list j for l in range(len(plus_list)):
    printlist.append(hashi1)
    printlist.append(plus_list[l])
    hashi1 = hashi1 - plus_list[l]
     l range(len(plus_list)) range len(plus_list) len plus_list printlist.append(hashi1) printlist.append printlist append hashi1 printlist.append(plus_list[l]) printlist.append printlist append plus_list[l] plus_list l hashi1 = hashi1 - plus_list[l] hashi1 hashi1 - plus_list[l] hashi1 plus_list[l] plus_list l printlist.append(hashi2) printlist.append printlist append hashi2 printlist.append(hashi1) printlist.append printlist append hashi1 print(hashi2-hashi1) print hashi2-hashi1 hashi2 hashi1 for n in range(0,len(printlist),2):
    print(printlist[n],printlist[n+1]) n range(0,len(printlist),2) range 0 len(printlist) len printlist 2 print(printlist[n],printlist[n+1]) print printlist[n] printlist n printlist[n+1] printlist n+1 n 1 n = int(input()) int(input()) n hashi1 = a[0] a[0] hashi1 hashi1 = hashi1 - plus_list[l] hashi1 - plus_list[l] hashi1 minus_list = [] [] minus_list a = input().split() input().split() a plus_list = [] [] plus_list hashi2 = a[-1] a[-1] hashi2 printlist = [] [] printlist hashi2 = hashi2-minus_list[j] hashi2-minus_list[j] hashi2
n = int(input())
a = input().split()
for i in range(len(a)):
    a[i]=int(a[i])
# print(a)
a.sort()
# print(a)
# #両端をとっておく
hashi1 = a[0]
hashi2 = a[-1]
a.remove(a[0])
a.remove(a[-1])
# print(a)
minus_list = []
plus_list = []
printlist = []
for i in range(len(a)):
    if a[i]>0:
        plus_list.append(a[i])
    else:
        minus_list.append(a[i])
# print(minus_list)
# print(plus_list)
for j in range(len(minus_list)):
    printlist.append(hashi2)
    printlist.append(minus_list[j])
    hashi2 = hashi2-minus_list[j]
    
for l in range(len(plus_list)):
    printlist.append(hashi1)
    printlist.append(plus_list[l])
    hashi1 = hashi1 - plus_list[l]
    
printlist.append(hashi2)
printlist.append(hashi1)
print(hashi2-hashi1)
# print(printlist)
for n in range(0,len(printlist),2):
    print(printlist[n],printlist[n+1])