#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int main() {
  int val[maxn] = {0}, sum[maxn] = {0}, dp[maxn] = {0};
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &val[i]);
  for (int i = n - 1; i >= 0; i--) sum[i] = sum[i + 1] + val[i];
  for (int i = n - 1; i >= 0; i--)
    dp[i] = max(dp[i + 1], sum[i + 1] - dp[i + 1] + val[i]);
  printf("%d %d\n", sum[0] - dp[0], dp[0]);
  return 0;
}
