#include <bits/stdc++.h>
const double eps = 1e-10;
using namespace std;
int n, m, k, b, a;
int in[100];
int f[100];
int answ = INT32_MAX;
vector<int> floors[123];
int main() {
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) scanf("%d", &in[i]);
  f[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    f[i] = abs(in[i] - f[i + 1]);
  }
  int sum = accumulate(in, in + n, 1ll);
  printf("%d %d\n", (sum - f[0]) / 2, (sum + f[0]) / 2);
  return 0;
  return 0;
}
