#include <bits/stdc++.h>
using namespace std;
int n, arr[100];
pair<int, int> dp[100][2];
pair<int, int> NU = {-1, -1};
pair<int, int> solve(int id, bool B) {
  if (id == n) return {0, 0};
  if (dp[id][B] != NU) return dp[id][B];
  pair<int, int> ans = {0, 0};
  if (B) {
    if (arr[id] + solve(id + 1, !B).first > ans.first) {
      ans = solve(id + 1, !B);
      ans.first += arr[id];
    }
    if (solve(id + 1, B).first > ans.first) {
      ans = solve(id + 1, B);
      ans.second += arr[id];
    }
  } else {
    if (arr[id] + solve(id + 1, !B).second > ans.second) {
      ans = solve(id + 1, !B);
      ans.second += arr[id];
    }
    if (solve(id + 1, B).second > ans.second) {
      ans = solve(id + 1, B);
      ans.first += arr[id];
    }
  }
  return dp[id][B] = ans;
}
int main() {
  scanf("%d", &n);
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  pair<int, int> ans = solve(0, 1);
  printf("%d %d\n", ans.second, ans.first);
  return 0;
}
