#include <bits/stdc++.h>
using namespace std;
const int N = 100;
long long v[N], acc[N];
pair<long long, long long> memo[N];
int vis[N];
int n;
pair<long long, long long> solve(int p) {
  if (p == n) return make_pair(0, 0);
  if (vis[p] == 0) {
    pair<long long, long long> a = solve(p + 1);
    pair<long long, long long> b = solve(p + 1);
    if (a.second + v[p] > b.first)
      memo[p] = make_pair(a.second + v[p], a.first);
    else
      memo[p] = make_pair(b.first, b.second + v[p]);
    vis[p] = 1;
  }
  return memo[p];
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = n - 1; i >= 0; --i) acc[i] = v[i] + acc[i + 1];
  pair<long long, long long> ans = solve(0);
  cout << ans.second << " " << ans.first << endl;
}
