#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
bool cmpManh(const std::pair<long long, long long>& l,
             const std::pair<long long, long long>& r) {
  return ((llabs(l.first) + llabs(l.second)) <
          (llabs(r.first) + llabs(r.second)));
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int main(void) {
  int n;
  scanf("%d", &n);
  vector<int> a;
  int cum[100] = {0}, dp[100] = {0};
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    a.push_back(x);
    sum += x;
    if (i)
      cum[i] = cum[i - 1] + x;
    else
      cum[i] = x;
  }
  dp[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    dp[i] = max(dp[i + 1], (sum - cum[i]) - dp[i + 1] + a[i]);
  }
  cout << sum - dp[0] << " " << dp[0] << '\n';
  return (0);
}
