#include <bits/stdc++.h>
int main() {
  int n, i, j, s = 0, d = 0, k;
  scanf("%d", &n);
  int a[1000] = {0}, b[1000] = {0};
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0, k = 0, j = n - 1; k < n; k++) {
    if (a[i] >= a[j]) {
      b[k] = a[i];
      i++;
    } else {
      b[k] = a[j];
      j--;
    }
  }
  for (i = 0, j = 1; i < n; i += 2, j += 2) {
    s = s + b[i];
    d = d + b[j];
  }
  printf("%d %d", s, d);
  return 0;
}
