#include <bits/stdc++.h>
using namespace std;
const double _pi = acos(-1.0);
int ar[100][2];
int main() {
  int n, r = 0;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
  }
  reverse(v.begin(), v.end());
  ar[0][0] = v[0];
  r = v[0];
  for (int i = 1; i < n; i++) {
    ar[i][0] = v[i] + r - max(ar[i - 1][1], ar[i - 1][0]);
    r += v[i];
    ar[i][1] = max(ar[i - 1][1], ar[i - 1][0]);
  }
  printf("%d %d\n", r - max(ar[n - 1][0], ar[n - 1][1]),
         max(ar[n - 1][0], ar[n - 1][1]));
  return 0;
}
