#include <bits/stdc++.h>
using namespace std;
const long long int INF{(false ? (INT_MAX - 1) / 2 : (long long int)1e18 + 5)};
long long int MOD = 1e9 + 7;
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      long long int l = a[i];
      if (i + 1 < n) {
        long long int r = min(l, a[i + 1]);
        ans += r;
        if (a[i + 1] - r > 0)
          continue;
        else {
          l -= r;
        }
      }
      long long int p = 0, p1 = 0, q = 0;
      for (long long int j = i + 2; j < n; j++) {
        if (j % 2 == 0)
          p += a[j], p1 = p - a[j];
        else {
          q = a[j];
          long long int r = min(q, p);
          p -= r;
          q -= r;
          if (p == 0) {
            ans += 1;
            long long int m = min(l, q);
            ans += m;
            l -= m;
            q -= m;
            if (q > 0) break;
          }
        }
      }
    }
  }
  cout << ans;
}
int main() {
  cout << setprecision(15);
  long long int t(1);
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}
