#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, n1, x[1005], s = 0, d = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int i = 0, k = 0;
  n1 = n;
  while (k < n1) {
    if (k % 2 == 0) {
      if (x[i] > x[n - 1])
        s += x[i++];
      else
        s += x[(n--) - 1];
    } else {
      if (x[i] > x[n - 1])
        d += x[i++];
      else
        d += x[(n--) - 1];
    }
    ++k;
  }
  cout << s << " " << d;
}
