#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long cnt = 0;
  for (int i = 0; i < n; i += 2) {
    long long curr = a[i];
    long long extra = 0;
    for (int j = i + 1; j < n; j++) {
      if (j % 2 == 0)
        extra += a[j];
      else {
        if (extra > a[j]) {
          extra -= a[j];
        } else {
          long long t = a[j];
          if (curr < a[i]) cnt += 1;
          t -= extra;
          extra = 0;
          if (curr >= t) {
            cnt += t;
            curr -= t;
          } else {
            cnt += curr;
            break;
          }
        }
      }
    }
  }
  cout << cnt << "\n";
  return 0;
}
