#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string>) {}
template<typename T1,typename T2> ostream& operator<<(ostream& os, pair<T1,T2> buf) {
  return os << "(" << buf.first << ": " << buf.second << ")"; }
#define DefOut(Con) template<typename T>ostream&operator<<(ostream&os,Con<T>&A){ bool f = false; os << "{"; \
  for (const auto e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
#define DefOut2(Con) template<typename K,typename V>ostream&operator<<(ostream&os,Con<K,V>&A) \
{ bool f = false; os << "{"; for (auto &e: A) { if (f) os << ", "; os << e; f = true; } return os << "}"; }
template<typename T>ostream &operator << (ostream &os,vector<vector<T>>& A) {
  for (auto &B: A) os << '\n' << B; return os; }
DefOut(vector) DefOut(set) DefOut(multiset) DefOut2(map) 
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << a << endl; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1000000007;
long long const INF = 1e18;
#define PI 3.14159265358979323846
/***********************************************************************/
int32_t main() {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vector<int> a(n);
  bool allneg = true, allpos = true;
  int opt = 0;
  for (int &z: a) {
    cin >> z;
    opt += abs(z);
    allneg &= z <= 0;
    allpos &= z >= 0;
  }
  sort(ALL(a), greater<int>());
  vector<pair<int,int>> ans;
  if (n == 2) {
    cout << a[0] - a[1] << '\n';
    cout << a[0] << ' ' << a[1] << '\n';
    return 0;
  }
  if (allneg) {
    int m = 0;
    ans.emplace_back(a[0], a[1]);
    int cur = a[0] - a[1];
    for (int i = 2; i < n; ++i) {
      ans.emplace_back(cur, a[i]);
      cur -= a[i];
    }
    m = cur;
    cout << m << '\n';
    for (auto e: ans) {
      cout << e.first << ' ' << e.second << '\n';
    }
    return 0;
  }
  if (allpos) {
    reverse(ALL(a));
    int m = 0;
    ans.emplace_back(a[0], a[1]);
    int cur = a[0] - a[1];
    for (int i = 2; i < n - 1; ++i) {
      ans.emplace_back(cur, a[i]);
      cur -= a[i];
    }
    ans.emplace_back(a[n - 1], cur);
    cur = a[n - 1] - cur;
    m = cur;
    cout << m << '\n';
    for (auto e: ans) {
      cout << e.first << ' ' << e.second << '\n';
    }
    return 0;
  }
  int cur = a[n - 1];
  for (int i = 1; i < n - 1; ++i) {
    if (a[i] >= 0) {
      ans.emplace_back(cur, a[i]);
      cur -= a[i];
    } else {
      break;
    }
  }
  ans.emplace_back(a[0], cur);
  cur = a[0] - cur;
  for (int i = 1; i < n - 1; ++i) {
    if (a[i] < 0) {
      ans.emplace_back(cur, a[i]);
      cur -= a[i];
    }
  }
  assert (SZ(ans) == n - 1);
  assert (cur == opt);
  cout << opt << '\n';
  for (auto e: ans) {
    cout << e.first << ' ' << e.second << '\n';
  }
  
  return 0;
}


Measured memory_bytes: 3188