10 20 10 5
 20 1 2 3
 7 2 2 2
 25 10 5 10
 999 999 899 299
 10000 5000 0 5000
 2 2 2 2
 1 0 2 0
 3 3 2 1
 1 1 0 0
 1 0 0 1
 20 10 20 30
 505 142 321 12
 101 10 10 50
 10 19 15 100
 10000 5000 5000 0
 1234 645 876 1000
 3 10 10 10
 1 0 1 0
 7 3 0 5
 101 10 0 50
 1 0 0 0
 10 0 8 10
 1 2 0 0
 5 2 1 1
 8765 2432 2789 4993
 8987 4000 2534 4534
 10000 5000 5000 5000
 10000 5000 2500 2500
 10000 0 5000 5000
 10000 4999 2500 2500
 5 5000 5000 5000
 10000 4534 2345 4231
 5643 1524 1423 2111
 7777 4444 3333 2222
 2500 5000 5000 5000
 10000 2500 2500 2500
 5000 5000 5000 5000

36
 0
 1
 12
 145000
 1251
 3
 1
 3
 0
 0
 57
 0
 33
 35
 0
 141636
 6
 1
 1
 3
 0
 5
 1
 0
 1697715
 2536267
 6253751
 1
 2501
 0
 12
 2069003
 146687
 1236544
 1565001
 0
 4691251

#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
#pragma warning(disable : 4018)
#pragma comment(linker, "/STACK:16777216");
using namespace std;
typedef long long ll;
typedef unsigned long long uint64;
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T isprime(T n) {
  if (n <= 1) return false;
  for (T i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
template <class T>
void stoset(string s, set<T> &res_set) {
  res_set.clear();
  istringstream sin(s);
  for (T v; sin >> v; res_set.insert(v))
    ;
}
template <typename T>
string NumberToString(T Number) {
  ostringstream ss;
  ss << Number;
  return ss.str();
}
ll dis(ll x1, ll y1, ll x2, ll y2) {
  return ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
double dist(double x1, double y1, double x2, double y2) {
  return sqrt(sqr(x1 - x2) + sqr(y1 - y2));
}
double distR(double x1, double y1, double x2, double y2) {
  return sqr(x1 - x2) + sqr(y1 - y2);
}
int main() {
  freopen("in.txt", "r", stdin);
  int a, b, c, n, cnt;
  while (cin >> n >> a >> b >> c) {
    cnt = 0;
    for (int i = 0; i <= b; i++) {
      for (int j = 0; j <= c; j++) {
        if ((2 * (n - i - 2 * j)) <= a) {
          cnt++;
        }
      }
    }
    cout << cnt / 2 << endl;
  }
  return 0;
}
