#include <bits/stdc++.h>
int num[1000 + 10];
int main() {
  int sum1, sum2, n, m;
  while (scanf("%d", &m) != EOF) {
    sum1 = sum2 = 0;
    for (int i = 1; i <= m; i++) scanf("%d", &num[i]);
    int count = 1;
    n = m;
    for (int j = 1; j <= m; j++) {
      if (num[n] > num[count]) {
        if (j % 2)
          sum1 += num[n];
        else
          sum2 += num[n];
        n--;
      } else {
        if (j % 2)
          sum1 += num[count];
        else
          sum2 += num[count];
        count++;
      }
    }
    printf("%d %d\n", sum1, sum2);
  }
  return 0;
}
