using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp2
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] AsArr = Read(Console.ReadLine());

            if (N == 1)
            {
                Console.WriteLine(AsArr[0]);
                return;
            }

            List<int> As = AsArr.ToList();
            As.Sort();

            if (As.Max() >= 0 && As.Min() <= 0)
            {
                int ans = 0;
                for (int i = 0; i < As.Count; i++)
                {
                    ans += Math.Abs(As[i]);
                }
                Console.WriteLine(ans);

                for (int i = 0; i < N - 2; i++)
                {
                    int x = As[1];
                    if (x > 0)
                    {
                        Console.WriteLine(As[0] + " " + x);
                        As[0] -= x;
                        As.RemoveAt(1);
                    }
                    else
                    {
                        Console.WriteLine(As[As.Count-1] + " " + x);
                        As[As.Count - 1] -= x;
                        As.RemoveAt(1);
                    }
                }
                Console.WriteLine(As[1] + " " + As[0]);

            }
            else if (As.Min() >= 0)
            {

                Console.WriteLine(As.Sum() - 2 * As.Min());
                Console.WriteLine(As[0] + " " + As[N - 1]);
                As[0] -= As[N-1];
                As.RemoveAt(N-1);

                for (int i = 0; i < N - 3; i++)
                {
                    int x = As[1];

                    Console.WriteLine(As[0] + " " + x);
                    As[0] -= x;
                    As.RemoveAt(1);

                }
                Console.WriteLine(As[1] + " " + As[0]);

            }
            else
            {

                Console.WriteLine(-1*As.Sum() + 2 * As.Max());
                Console.WriteLine(As[N-1] + " " + As[0]);
                As[N-1] -= As[0];
                As.RemoveAt(0);

                for (int i = 0; i < N - 3; i++)
                {
                    int x = As[0];

                    Console.WriteLine(As[As.Count-1] + " " + x);
                    As[As.Count-1] -= x;
                    As.RemoveAt(0);

                }
                Console.WriteLine(As[1] + " " + As[0]);
            }




        }

        private static int Stair(int N)
        {
            if (N < 0) return 0;
            int twoM = N / 2;
            int ans = 0;
            for (int two = 0; two < twoM+1; two++)
            {
                int one = N - 2 * two;
                ans += Combination(one + two,two);
            }
            return ans;
        }

        private static int Combination(int N,int M)
        {
            
            int ans = Product(N) / (Product(M) * Product(N - M));
            return ans;

        }

        private static int Product(int N)
        {
            if (N == 0||N ==1) return 1;
            int ans = N;
            for (int i = 1; i < N; i++)
            {
                ans *= i;
            }
            return ans;
        }





        //private static string ReplaceOneChar(string S ,int index,string newS)
        //{
        //    string s1 = S.Substring(0, index-1);
        //    string s2 = S.Substring(index);
        //    return s1 + newS + s2;
        //}

        private static int[] Read(string input)
        {
            string[] inputs = input.Split(' ');
            int num = inputs.Length;
            int[] ints = new int[num];
            for (int i = 0; i < num; i++)
            {
                ints[i] = int.Parse(inputs[i]);
            }
            
            return ints;
        }


    }


}


Measured memory_bytes: 28360