#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
int C[MAXN];
int N;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> C[i];
  }
  long long cnt = 0;
  for (int j = 1; j < N; j += 2) {
    long long h = 0;
    long long internal = -C[j];
    for (int i = j - 1; i >= 0; i -= 2) {
      h += C[i + 1];
      internal += C[i + 1];
      if (C[i] > h) {
        cnt += h - internal;
        if (internal) ++cnt;
        break;
      }
      if (C[i] >= internal) {
        cnt += C[i] - internal;
        if (internal) ++cnt;
      }
      internal -= min((long long)C[i], internal);
      h -= C[i];
    }
  }
  cout << cnt << endl;
  return 0;
}
