#include <bits/stdc++.h>
using namespace std;
int n, a, b, c, f = 0;
int main() {
  cin >> n >> a >> b >> c;
  for (int i = 0; i <= c; i++) {
    for (int j = 0; j <= b; j++) {
      if (n - j - 2 * i >= 0 && n - j - 2 * i <= a / 2) {
        f++;
      }
    }
  }
  cout << f;
}
