#include <bits/stdc++.h>
using namespace std;
int64_t c[1000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  int64_t ans = 0;
  for (int st = 0; st < n - 1; st += 2) {
    int64_t co = 0;
    int64_t sv = c[st];
    for (int i = st + 1; i < n; ++i) {
      if (i % 2) {
        {
          if (co <= c[i]) {
            ans += min(sv, c[i] - co);
            if (sv < c[st]) {
              ans++;
            }
          }
        }
        co -= c[i];
      } else {
        co += c[i];
      }
      if (co + sv < 0) {
        break;
      }
      if (co < 0) {
        sv = co + sv;
        co = 0;
      }
    }
  }
  cout << ans << "\n";
}
