#include <bits/stdc++.h>
using namespace std;
long long a[100], dp[100][3], suf[100], n;
long long solve(long long i, long long player) {
  if (i == n) return 0;
  if (dp[i][player]) return dp[i][player];
  dp[i][player] =
      max(a[i] + suf[i + 1] - solve(i + 1, 1 - player), solve(i + 1, player));
  return dp[i][player];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  suf[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    suf[i] = suf[i + 1] + a[i];
  }
  long long xx = solve(0, 0);
  cout << suf[0] - xx << ' ' << xx << '\n';
}
