#include <bits/stdc++.h>
using namespace std;
int dp[100][3], v[100];
int main() {
  int n, sum;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sum = 0;
  for (int i = n - 1; i >= 0; --i) {
    for (int j = 0; j < 2; ++j) {
      dp[i][j] = max(dp[i + 1][j], sum - dp[i + 1][(j + 1) % 2] + v[i]);
    }
    sum += v[i];
  }
  cout << sum - dp[0][0] << ' ' << dp[0][0];
  return 0;
}
