#include <bits/stdc++.h>
using namespace std;
int n, a[101], d[2][101];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  d[0][n] = d[1][n] = a[n];
  int c = a[n];
  for (int i = n - 1; i >= 1; i--) {
    d[0][i] = max(a[i] + c - d[1][i + 1], d[0][i + 1]);
    d[1][i] = max(a[i] + c - d[0][i + 1], d[1][i + 1]);
    c += a[i];
  }
  cout << c - d[1][1] << " " << d[1][1] << endl;
  return 0;
}
