using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            var nums = consoleReader.Split.Int;

            var max = int.MinValue;
            var min = int.MaxValue;
            var maxIndex = -1;
            var minIndex = -1;
            for (int i = 0; i < nums.Length; i++)
            {
                if (max < nums[i])
                {
                    maxIndex = i;
                    max = nums[i];
                }
                if (min > nums[i])
                {
                    minIndex = i;
                    min = nums[i];
                }
            }
            if(maxIndex == minIndex)
            {
                ++minIndex;
            }

            var res = new List<string> { "" };

            for (int i = 0; i < nums.Length; i++)
            {
                if (i == maxIndex || i == minIndex) continue;
                if(nums[i] < 0)
                {
                    res.Add($"{max} {nums[i]}");
                    max -= nums[i];
                }
                else
                {
                    res.Add($"{min} {nums[i]}");
                    min -= nums[i];
                }

            }
            res.Add($"{max} {min}");
            res[0] = Math.Abs(max - min).ToString();
            return AllLines(res);
        }

        #region いつもの
        private readonly ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader()).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
        #endregion
    }

    public static class DicExt
    {
        public static V GetOrDefault<K, V>(this IDictionary<K, V> dic, K key, V defaultValue = default(V))
        {
            V val;
            return dic.TryGetValue(key, out val) ? val : defaultValue;
        }
        public static V GetOrInit<K, V>(this IDictionary<K, V> dic, K key) where V : new()
        {
            V val;
            if (dic.TryGetValue(key, out val))
                return val;

            val = new V();
            dic.Add(key, val);
            return val;
        }
    }
#pragma warning disable
    public class ConsoleReader { public class SplitLine { string[] splited; public SplitLine(string line) { splited = line.Split(); } public string[] String => splited.ToArray(); public int[] Int => splited.Select(int.Parse).ToArray(); public long[] Long => splited.Select(long.Parse).ToArray(); public ulong[] ULong => splited.Select(ulong.Parse).ToArray(); public double[] Double => splited.Select(double.Parse).ToArray(); } public class RepeatLine { ConsoleReader reader; int num; public RepeatLine(ConsoleReader reader, int num) { this.reader = reader; this.num = num; } public IEnumerable<string> String { get { for (int i = 0; i < num; i++) yield return reader.String; } } public IEnumerable<int> Int { get { for (int i = 0; i < num; i++) yield return reader.Int; } } public IEnumerable<long> Long { get { for (int i = 0; i < num; i++) yield return reader.Long; } } public IEnumerable<string[]> Split { get { for (int i = 0; i < num; i++) yield return reader.Split.String; } } public IEnumerable<int[]> SplitInt { get { for (int i = 0; i < num; i++) yield return reader.Split.Int; } } } public virtual string String => Console.ReadLine(); public int Int => int.Parse(String); public long Long => long.Parse(String); public ulong ULong => ulong.Parse(String); public double Double => double.Parse(String); public SplitLine Split => new SplitLine(String); public RepeatLine Repeat(int count) => new RepeatLine(this, count); }
}

Measured memory_bytes: 40496