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