#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 1;
int n, a[N], dp[N][2], sum, x, y;
int f(int i, bool t) {
  int &ret = dp[i][t];
  if (i == n) return 0;
  if (ret != -1) return ret;
  ret = 0;
  if (!t)
    return ret = max(f(i + 1, t), f(i + 1, !t) + a[i]);
  else
    return ret = min(f(i + 1, !t), f(i + 1, t) + a[i]);
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  x = f(0, 0);
  y = sum - x;
  cout << y << " " << x;
}
