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.

Constraints

* 2 \leq N \leq 10^5
* -10^4 \leq A_i \leq 10^4
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
A_1 A_2 ... A_N


Output

Print the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.

Here x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.

If there are multiple sequences of operations that maximize the final integer, any of them will be accepted.


M
x_1 y_1
:
x_{N-1} y_{N-1}

Output

Print the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.

Here x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.

If there are multiple sequences of operations that maximize the final integer, any of them will be accepted.


M
x_1 y_1
:
x_{N-1} y_{N-1}

Examples

Input

3
1 -1 2


Output

4
-1 1
2 -2


Input

3
1 1 1


Output

1
1 1
1 0
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        FastScanner sc = new FastScanner();

        int N = sc.nextInt();
        int A[] = sc.nextIntArray(N);

        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        for (int i=0;i<N;i++) {
            min = Math.min(min, A[i]);
            max = Math.max(max, A[i]);
        }

        boolean pos_flg[] = new boolean[N];
        boolean min_flg = false;
        boolean max_flg = false;
        for (int i=0;i<N;i++) {
            if (A[i] == min) {
                if (min_flg == false) {
                    min_flg = true;
                    pos_flg[i] = false;
                    continue;
                }
            }

            if (A[i] == max) {
                if (max_flg == false) {
                    max_flg = true;
                    pos_flg[i] = true;
                    continue;
                }
            }

            pos_flg[i] = A[i] >= 0;
        }

        int pos_cnt = 0;
        int neg_cnt = 0;
        ArrayList<Integer> pos_list = new ArrayList<Integer>();
        ArrayList<Integer> neg_list = new ArrayList<Integer>();
        for (int i=0;i<N;i++) {
            if (pos_flg[i]) {
                pos_cnt++;
                pos_list.add(A[i]);
            }
            else {
                neg_cnt++;
                neg_list.add(A[i]);
            }
        }

        int M = 0;
        int ope[][] = new int[N-1][2];
        for (int i=0;i<N-1;i++) {
            if (i == 0) {
                if (pos_cnt == 1) {
                    ope[i][0] = pos_list.get(--pos_cnt);
                    ope[i][1] = neg_list.get(--neg_cnt);
                } else {
                    ope[i][1] = pos_list.get(--pos_cnt);
                    ope[i][0] = neg_list.get(--neg_cnt);
                }
            } else {
                if (pos_cnt == 1) {
                    ope[i][0] = pos_list.get(--pos_cnt);
                    ope[i][1] = M;
                } else if (pos_cnt > 1) {
                    ope[i][0] = M;
                    ope[i][1] = pos_list.get(--pos_cnt);
                } else {
                    ope[i][0] = M;
                    ope[i][1] = neg_list.get(--neg_cnt);
                }
            }

            M = ope[i][0] - ope[i][1];
        }

        out.println(M);
        for (int i=0;i<N-1;i++) {
            out.printf("%d %d\n", ope[i][0], ope[i][1]);
        }

        out.flush();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }

        int[] nextIntArray(int N) {
            int a[] = new int[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextInt();
            }

            return a;
        }

        long[] nextLongArray(int N) {
            long a[] = new long[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextLong();
            }

            return a;
        }

        double[] nextDoubleArray(int N) {
            double a[] = new double[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextDouble();
            }

            return a;
        }

        String[] nextTokenArray(int N) {
            String a[] = new String[N];
            for (int i=0;i<N;i++) {
                a[i] = this.nextToken();
            }

            return a;
        }
    }
}