def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    non_negative = len(list(filter(lambda x: x >= 0, a)))
    negative = n - non_negative
    if non_negative == 0:
        negative = n - 1
        non_negative = 1
    elif negative == 0:
        negative = 1
        non_negative = n - 1
    neg_num = a[:negative]
    non_neg_num = a[-non_negative:]
    ope = []
    for nnn in non_neg_num[:-1]:
        ope.append([neg_num[0], nnn])
        neg_num[0] -= nnn
    for nn in neg_num:
        ope.append([non_neg_num[-1], nn])
        non_neg_num[-1] -= nn
    print(non_neg_num[-1])
    for i, j in ope:
        print(i, j)


if __name__ == '__main__':
    main() def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    non_negative = len(list(filter(lambda x: x >= 0, a)))
    negative = n - non_negative
    if non_negative == 0:
        negative = n - 1
        non_negative = 1
    elif negative == 0:
        negative = 1
        non_negative = n - 1
    neg_num = a[:negative]
    non_neg_num = a[-non_negative:]
    ope = []
    for nnn in non_neg_num[:-1]:
        ope.append([neg_num[0], nnn])
        neg_num[0] -= nnn
    for nn in neg_num:
        ope.append([non_neg_num[-1], nn])
        non_neg_num[-1] -= nn
    print(non_neg_num[-1])
    for i, j in ope:
        print(i, j) 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 non_negative = len(list(filter(lambda x: x >= 0, a))) non_negative len(list(filter(lambda x: x >= 0, a))) len list(filter(lambda x: x >= 0, a)) list filter(lambda x: x >= 0, a) filter lambda x: x >= 0 x >= 0 x 0 x a negative = n - non_negative negative n - non_negative n non_negative if non_negative == 0:
        negative = n - 1
        non_negative = 1
    elif negative == 0:
        negative = 1
        non_negative = n - 1
     non_negative == 0 non_negative 0 negative = n - 1 negative n - 1 n 1 non_negative = 1 non_negative 1 elif negative == 0:
        negative = 1
        non_negative = n - 1
     negative == 0 negative 0 negative = 1 negative 1 non_negative = n - 1 non_negative n - 1 n 1 neg_num = a[:negative] neg_num a[:negative] a :negative negative non_neg_num = a[-non_negative:] non_neg_num a[-non_negative:] a -non_negative: -non_negative non_negative ope = [] ope [] for nnn in non_neg_num[:-1]:
        ope.append([neg_num[0], nnn])
        neg_num[0] -= nnn
     nnn non_neg_num[:-1] non_neg_num :-1 -1 ope.append([neg_num[0], nnn]) ope.append ope append [neg_num[0], nnn] neg_num[0] neg_num 0 nnn neg_num[0] -= nnn neg_num[0] neg_num 0 nnn for nn in neg_num:
        ope.append([non_neg_num[-1], nn])
        non_neg_num[-1] -= nn
     nn neg_num ope.append([non_neg_num[-1], nn]) ope.append ope append [non_neg_num[-1], nn] non_neg_num[-1] non_neg_num -1 nn non_neg_num[-1] -= nn non_neg_num[-1] non_neg_num -1 nn print(non_neg_num[-1]) print non_neg_num[-1] non_neg_num -1 for i, j in ope:
        print(i, j) i j ope print(i, j) print i j if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    non_negative = len(list(filter(lambda x: x >= 0, a)))
    negative = n - non_negative
    if non_negative == 0:
        negative = n - 1
        non_negative = 1
    elif negative == 0:
        negative = 1
        non_negative = n - 1
    neg_num = a[:negative]
    non_neg_num = a[-non_negative:]
    ope = []
    for nnn in non_neg_num[:-1]:
        ope.append([neg_num[0], nnn])
        neg_num[0] -= nnn
    for nn in neg_num:
        ope.append([non_neg_num[-1], nn])
        non_neg_num[-1] -= nn
    print(non_neg_num[-1])
    for i, j in ope:
        print(i, j) def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    non_negative = len(list(filter(lambda x: x >= 0, a)))
    negative = n - non_negative
    if non_negative == 0:
        negative = n - 1
        non_negative = 1
    elif negative == 0:
        negative = 1
        non_negative = n - 1
    neg_num = a[:negative]
    non_neg_num = a[-non_negative:]
    ope = []
    for nnn in non_neg_num[:-1]:
        ope.append([neg_num[0], nnn])
        neg_num[0] -= nnn
    for nn in neg_num:
        ope.append([non_neg_num[-1], nn])
        non_neg_num[-1] -= nn
    print(non_neg_num[-1])
    for i, j in ope:
        print(i, j) main
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    non_negative = len(list(filter(lambda x: x >= 0, a)))
    negative = n - non_negative
    if non_negative == 0:
        negative = n - 1
        non_negative = 1
    elif negative == 0:
        negative = 1
        non_negative = n - 1
    neg_num = a[:negative]
    non_neg_num = a[-non_negative:]
    ope = []
    for nnn in non_neg_num[:-1]:
        ope.append([neg_num[0], nnn])
        neg_num[0] -= nnn
    for nn in neg_num:
        ope.append([non_neg_num[-1], nn])
        non_neg_num[-1] -= nn
    print(non_neg_num[-1])
    for i, j in ope:
        print(i, j)


if __name__ == '__main__':
    main()
