include
using namespace std; int a[105];
void input() {
cin >> n;
for (int i = 1; i < n; i+=2) {
cin >> a[i];
}
}
bool check(int x) {
int hp = x;
for (int i = 1; i <= n; i++) {
hp -= a[i];
if (hp == 0)
return false;
}
return true;
}
void work() {
int l = 100, r = 1000 * 100000000000000, mid;
int ans = r+l;
while (l <= r) {
mid = (l + r) / 2;
if (check(mid)) {
ans = min(mid, ans);
r = mid - 1;
} else
l = mid + 1;
}
cout << ans << endl;
}
int main() { // freopen("dragon4.in", "r", stdin); // freopen("dragon4.out", "w", stdout);
input();
work();
return 0;
}
