#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];

  sort(A.begin(), A.end());

  int ans = 0;
  for (int i = 0; i < N; i++) ans += abs(A[i]);
  if (A[0] > 0) ans -= A[0] * 2;
  if (A[N - 1] < 0) ans += A[N - 1] * 2;
  cout << ans << endl;

  int now = A[0];

  for (int i = 1; i < N - 1; i++) {
    if (A[i] >= 0) {
      cout << now << " " << A[i] << endl;
      now -= A[i];
    }
  }

  cout << A[N - 1] << " " << now << endl;
  now = A[N - 1] - now;

  for (int i = 1; i < N - 1; i++) {
    if (A[i] < 0) {
      cout << now << " " << A[i] << endl;
      now -= A[i];
    }
  }
  return 0;
}
