#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[2000], s = 0, d = 0, i, t = 0, g, j;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0, j = n - 1; i < n, j >= i; i++, j--) {
    if (a[i] >= a[j]) {
      g = a[i];
      j++;
    } else {
      g = a[j];
      i--;
    }
    if (t % 2 == 0) {
      s = s + g;
      t++;
    } else {
      d = d + g;
      t++;
    }
  }
  cout << s << " " << d << endl;
}
