func solver7() {
    var plus:Array<Int>=[], minus:Array<Int>=[]
    let _ = Int(readLine()!)!
    let sn = readLine()!.split(separator: " ").map({Int($0)!})
    var wholesum = 0
    var absmin = abs(sn.first!)
    var zerocount = 0
    for c in sn {
        wholesum += abs(c)
        absmin=min(absmin,abs(c))
        if c>0 {plus.append(c)}
        else if c<0 {minus.append(c)}
        else {zerocount+=1}
    }
    if wholesum==0 {print(0)}
    else {
        var vans = wholesum
        if zerocount==0 && plus.count*minus.count==0 {vans -= 2 * absmin}
        print(vans)
    }
    if zerocount>1 {for _ in 1...zerocount-1 {print(0,0)}}

    plus = plus.sorted(by:>)
    minus = minus.sorted(by:<)
    if plus.count*minus.count==0 {
        if plus.count+minus.count==0 {
            return
        } else {
            if plus.count != 0 {
                if plus.count==1 {
                    print(plus.first!,0)
                    return
                } else if plus.count==2 {
                    if zerocount>0 {
                        print(0,plus.last!)
                        print(plus.first!,-1*plus.last!)
                    } else {print(plus.first!,plus.last!)}
                    return
                } else {
                    if zerocount != 0 {plus.append(0)}
                    let l1 = plus.popLast()!
                    let l2 = plus.popLast()!
                    print(l1,l2)
                    minus.append(l1-l2)
                }
            } else {
                if minus.count==1 {
                    print(0,minus.first!)
                    return
                } else if minus.count==2 {
                    if zerocount>0 {
                        print(0,minus.last!)
                        print(-1*minus.last!, minus.first!)
                    } else {print(minus.last!, minus.first!)}
                    return
                } else {
                    if zerocount != 0 {minus.append(0)}
                    let l1 = minus.popLast()!
                    let l2 = minus.popLast()!
                    print(l1,l2)
                    plus.append(l1-l2)
                }
            }
        }
    } else {
        if zerocount>0 {
            if plus.count<=minus.count {plus.append(0)}
            else {minus.append(0)}
        }
    }
    while plus.count>1 || minus.count>1 {
        if plus.count >= minus.count {
            print(minus.last!,plus.last!)
            minus[minus.count-1]-=plus.popLast()!
        } else {
            print(plus.last!,minus.last!)
            plus[plus.count-1]-=minus.popLast()!
        }
    }
    print(plus.first!,minus.first!)
    return
}
solver7()