#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> dp[55][3];
long long a[55];
pair<long long, long long> solve(int pos, int k) {
  if (pos >= n)
    return pair<long long, long long>(0, 0);
  else if (dp[pos][k].first != -1)
    return dp[pos][k];
  pair<long long, long long> res;
  long long res1 = 0, res2 = 0, temp1 = 0, temp2 = 0;
  if (k == 0) {
    res1 = solve(pos + 1, k).first;
    temp1 = a[pos] + solve(pos + 1, k).second;
    res2 = a[pos] + solve(pos + 1, k ^ 1).first;
    temp2 = solve(pos + 1, k ^ 1).second;
    if (res1 > res2)
      res = pair<long long, long long>(res1, temp1);
    else
      res = pair<long long, long long>(res2, temp2);
  } else {
    res1 = solve(pos + 1, k).second;
    temp1 = a[pos] + solve(pos + 1, k).first;
    res2 = a[pos] + solve(pos + 1, k ^ 1).second;
    temp2 = solve(pos + 1, k ^ 1).first;
    if (res1 > res2)
      res = pair<long long, long long>(temp1, res1);
    else
      res = pair<long long, long long>(temp2, res2);
  }
  return dp[pos][k] = res;
}
int main() {
  int i;
  pair<long long, long long> ans;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  memset(dp, -1, sizeof(dp));
  ans = solve(0, 0);
  printf("%lld %lld\n", ans.second, ans.first);
  return 0;
}
