#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, arr[10000], serasum = 0, dimasum = 0, rightcount = 0, leftcount = 0,
                     temp = 0;
  bool flag = true;
  cin >> n;
  temp = n;
  for (size_t i = 0; i < n; i++) cin >> arr[i];
  while (n) {
    if (flag == true) {
      serasum += max(arr[temp - 1 - rightcount], arr[0 + leftcount]);
      if (arr[temp - 1 - rightcount] > arr[0 + leftcount])
        rightcount++;
      else
        leftcount++;
      flag = false;
    } else if (flag == false) {
      dimasum += max(arr[temp - 1 - rightcount], arr[0 + leftcount]);
      if (arr[temp - 1 - rightcount] > arr[0 + leftcount])
        rightcount++;
      else
        leftcount++;
      flag = true;
    }
    n--;
  }
  cout << serasum << " " << dimasum;
  return 0;
}
