#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
  int n;
  vector<int> datas;
  vector<int> sums;

  while (cin >> n, n != 0) {
    int input;
    for (int n_i = 0; n_i < n; n_i++) {
      cin >> input;
      datas.push_back(input);
    }
    for (int data_i = 0; data_i < n-1; data_i++) {
      sums.push_back(datas[data_i]+datas[data_i+1]);
    }

    int max = *sums.begin();
    for (auto sum_i = sums.begin(); sum_i != sums.end(); sum_i++)
      if (max < *sum_i)
        max = *sum_i;
    cout << max << endl;
  }

  return 0;
}