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 comment(linker, "/STACK:102400000,102400000")
const double Pi = acos(-1.0);
const double eps = 1e-6;
const double Ee = 2.718281828459045235360;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 1000000007;
const int dx4[] = {-1, 0, 1, 0};
const int dy4[] = {0, 1, 0, -1};
const int dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};
using namespace std;
namespace Math {
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long extendGCD(long long a, long long b, long long &x, long long &y) {
  if (!b) return x = 1, y = 0, a;
  long long res = extendGCD(b, a % b, x, y), tmp = x;
  x = y, y = tmp - (a / b) * y;
  return res;
}
long long power(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res *= x;
    x *= x, k >>= 1;
  }
  return res;
}
long long powerMod(long long x, long long k, long long m) {
  long long res = 1;
  while (x %= m, k) {
    if (k & 1) res *= x, res %= m;
    x *= x, k >>= 1;
  }
  return res;
}
long long inverse(long long a, long long p, long long t = 1) {
  long long pt = power(p, t);
  long long x, y;
  y = extendGCD(a, pt, x, y);
  return x < 0 ? x += pt : x;
}
long long linearCongruence(long long a, long long b, long long p, long long q) {
  long long x, y;
  y = extendGCD(p, q, x, y);
  while (b < a) b += q / y;
  x *= b - a, x = p * x + a, x %= p * q;
  if (x < 0) x += p * q;
  return x;
}
const int PRIMERANGE = 1000000;
int prime[PRIMERANGE + 1];
int mobius[PRIMERANGE + 1];
int getPrime() {
  memset(prime, 0, sizeof(int) * (PRIMERANGE + 1));
  memset(mobius, 0, sizeof(mobius));
  mobius[1] = 1;
  for (int i = 2; i <= PRIMERANGE; i++) {
    if (!prime[i]) prime[++prime[0]] = i, mobius[i] = -1;
    for (int j = 1; j <= prime[0] && prime[j] <= PRIMERANGE / i; j++) {
      prime[prime[j] * i] = 1;
      if (i % prime[j] == 0)
        break;
      else
        mobius[i * prime[j]] = -mobius[i];
    }
  }
  return prime[0];
}
int factor[100][3], facCnt;
int getFactors(int x) {
  facCnt = 0;
  int tmp = x;
  for (int i = 1; prime[i] <= tmp / prime[i]; i++) {
    factor[facCnt][1] = 1, factor[facCnt][2] = 0;
    if (tmp % prime[i] == 0) factor[facCnt][0] = prime[i];
    while (tmp % prime[i] == 0)
      factor[facCnt][2]++, factor[facCnt][1] *= prime[i], tmp /= prime[i];
    if (factor[facCnt][1] > 1) facCnt++;
  }
  if (tmp != 1)
    factor[facCnt][0] = tmp, factor[facCnt][1] = tmp, factor[facCnt++][2] = 1;
  return facCnt;
}
long long combinationModP(long long n, long long k, long long p) {
  if (k > n) return 0;
  if (n - k < k) k = n - k;
  long long a = 1, b = 1, x, y;
  int pcnt = 0;
  for (int i = 1; i <= k; i++) {
    x = n - i + 1, y = i;
    while (x % p == 0) x /= p, pcnt++;
    while (y % p == 0) y /= p, pcnt--;
    x %= p, y %= p, a *= x, b *= y;
    b %= p, a %= p;
  }
  if (pcnt) return 0;
  extendGCD(b, p, x, y);
  if (x < 0) x += p;
  a *= x, a %= p;
  return a;
}
long long inv[100005];
long long ba[100005];
long long rba[100005];
void Init_Com() {
  inv[0] = inv[1] = 1;
  ba[0] = ba[1] = 1;
  rba[0] = rba[1] = 1;
  for (int i = 2; i < 100005; i++) {
    inv[i] = ((MOD - MOD / i) * inv[MOD % i]) % MOD;
    ba[i] = (ba[i - 1] * i) % MOD;
    rba[i] = (rba[i - 1] * inv[i]) % MOD;
  }
}
long long C(int n, int m) { return (ba[n] * rba[m] % MOD) * rba[n - m] % MOD; }
int fib[1000000];
int Fib(int a, int b, int n) {
  if (n == 0) return a;
  if (n == 1) return b;
  return (a * fib[n - 1] % MOD + b * fib[n] % MOD) % MOD;
}
};  // namespace Math
namespace Geo {
const double eps = 1e-9;
int dblcmp(double d) { return d < -eps ? -1 : d > eps; }
struct Point {
  double x, y;
  Point() {}
  Point(double _x, double _y) : x(_x), y(_y){};
  void input() { scanf("%lf%lf", &x, &y); }
  void output() { printf("%.2f %.2f\n", x, y); }
  bool operator==(Point a) const {
    return dblcmp(a.x - x) == 0 && dblcmp(a.y - y) == 0;
  }
  bool operator<(Point a) const {
    return dblcmp(a.x - x) == 0 ? dblcmp(y - a.y) < 0 : x < a.x;
  }
  double len() { return hypot(x, y); }
  double len2() { return x * x + y * y; }
  double distance(Point p) { return hypot(x - p.x, y - p.y); }
  double distance2(Point p) {
    return ((x - p.x) * (x - p.x)) + ((y - p.y) * (y - p.y));
  }
  Point add(Point p) { return Point(x + p.x, y + p.y); }
  Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
  Point sub(Point p) { return Point(x - p.x, y - p.y); }
  Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
  Point mul(double b) { return Point(x * b, y * b); }
  Point div(double b) { return Point(x / b, y / b); }
  double dot(Point p) { return x * p.x + y * p.y; }
  double operator*(const Point &p) const { return x * p.x + y * p.y; }
  double det(Point p) { return x * p.y - y * p.x; }
  double operator^(const Point &p) const { return x * p.y - y * p.x; }
  double rad(Point a, Point b) {
    Point p = *this;
    return fabs(atan2(fabs(a.sub(p).det(b.sub(p))), a.sub(p).dot(b.sub(p))));
  }
  Point trunc(double r) {
    double l = len();
    if (!dblcmp(l)) return *this;
    r /= l;
    return Point(x * r, y * r);
  }
  Point rotleft() { return Point(-y, x); }
  Point rotright() { return Point(y, -x); }
  Point rotate(Point p, double angle) {
    Point v = this->sub(p);
    double c = cos(angle), s = sin(angle);
    return Point(p.x + v.x * c - v.y * s, p.y + v.x * s + v.y * c);
  }
};
struct Line {
  Point a, b;
};
};  // namespace Geo
namespace BigNum {
class BigInteger {
 private:
  int a[10010];
  int length;

 public:
  BigInteger() {
    length = 1;
    memset(a, 0, sizeof(a));
  }
  BigInteger(const int);
  BigInteger(const char *);
  BigInteger(const BigInteger &);
  BigInteger &operator=(const BigInteger &);
  friend istream &operator>>(istream &, BigInteger &);
  friend ostream &operator<<(ostream &, BigInteger &);
  BigInteger operator+(const BigInteger &) const;
  BigInteger operator-(const BigInteger &) const;
  BigInteger operator*(const BigInteger &) const;
  BigInteger operator/(const int &) const;
  BigInteger operator^(const int &) const;
  int operator%(const int &) const;
  bool operator>(const BigInteger &T) const;
  bool operator>(const int &t) const;
  void print();
};
BigInteger::BigInteger(const int b) {
  int c, d = b;
  length = 0;
  memset(a, 0, sizeof(a));
  while (d > 9999) {
    c = d - (d / (9999 + 1)) * (9999 + 1);
    d = d / (9999 + 1);
    a[length++] = c;
  }
  a[length++] = d;
}
BigInteger::BigInteger(const char *s) {
  memset(a, 0, sizeof(a));
  int L = strlen(s);
  length = L / 4;
  if (L % 4) length++;
  int index = 0;
  for (int i = L - 1; i >= 0; i -= 4) {
    int t = 0;
    int k = i - 4 + 1;
    if (k < 0) k = 0;
    for (int j = k; j <= i; ++j) t = t * 10 + s[j] - '0';
    a[index++] = t;
  }
}
BigInteger::BigInteger(const BigInteger &T) : length(T.length) {
  memset(a, 0, sizeof(a));
  for (int i = 0; i < length; i++) a[i] = T.a[i];
}
BigInteger &BigInteger::operator=(const BigInteger &n) {
  length = n.length;
  memset(a, 0, sizeof(a));
  for (int i = 0; i < length; i++) a[i] = n.a[i];
  return *this;
}
istream &operator>>(istream &in, BigInteger &b) {
  char ch[1010 * 4];
  in >> ch;
  int i = -1, L = strlen(ch), count = 0, sum = 0;
  for (i = L - 1; i >= 0;) {
    sum = 0;
    int t = 1;
    for (int j = 0; j < 4 && i >= 0; j++, i--, t *= 10) {
      sum += (ch[i] - '0') * t;
    }
    b.a[count] = sum;
    count++;
  }
  b.length = count++;
  return in;
}
ostream &operator<<(ostream &out, BigInteger &b) {
  cout << b.a[b.length - 1];
  for (int i = b.length - 2; i >= 0; i--) {
    cout.width(4);
    cout.fill('0');
    cout << b.a[i];
  }
  return out;
}
BigInteger BigInteger::operator+(const BigInteger &T) const {
  BigInteger t(*this);
  int big;
  big = T.length > length ? T.length : length;
  for (int i = 0; i < big; ++i) {
    t.a[i] += T.a[i];
    if (t.a[i] > 9999) {
      t.a[i + 1]++;
      t.a[i] -= 9999 + 1;
    }
  }
  if (t.a[big] != 0)
    t.length = big + 1;
  else
    t.length = big;
  return t;
}
BigInteger BigInteger::operator-(const BigInteger &T) const {
  int big;
  bool flag;
  BigInteger t1, t2;
  if (*this > T) {
    t1 = *this;
    t2 = T;
    flag = 0;
  } else {
    t1 = T;
    t2 = *this;
    flag = 1;
  }
  big = t1.length;
  for (int i = 0; i < big; ++i) {
    if (t1.a[i] < t2.a[i]) {
      int j = i + 1;
      while (t1.a[j] == 0) j++;
      t1.a[j--]--;
      while (j > i) t1.a[j--] += 9999;
      t1.a[i] += 9999 + 1 - t2.a[i];
    } else
      t1.a[i] -= t2.a[i];
  }
  t1.length = big;
  while (t1.a[t1.length - 1] == 0 && t1.length > 1) {
    t1.length--;
    big--;
  }
  if (flag) t1.a[big - 1] = 0 - t1.a[big - 1];
  return t1;
}
BigInteger BigInteger::operator*(const BigInteger &T) const {
  BigInteger ret;
  int i, j, temp, temp1;
  for (i = 0; i < length; ++i) {
    int up = 0;
    for (j = 0; j < T.length; ++j) {
      temp = a[i] * T.a[j] + ret.a[i + j] + up;
      if (temp > 9999) {
        temp1 = temp - temp / (9999 + 1) * (9999 + 1);
        up = temp / (9999 + 1);
        ret.a[i + j] = temp1;
      } else {
        up = 0;
        ret.a[i + j] = temp;
      }
    }
    if (up != 0) ret.a[i + j] = up;
  }
  ret.length = i + j;
  while (ret.a[ret.length - 1] == 0 && ret.length > 1) ret.length--;
  return ret;
}
BigInteger BigInteger::operator/(const int &b) const {
  BigInteger ret;
  int down = 0;
  for (int i = length - 1; i >= 0; --i) {
    ret.a[i] = (a[i] + down * (9999 + 1)) / b;
    down = a[i] + down * (9999 + 1) - ret.a[i] * b;
  }
  ret.length = length;
  while (ret.a[ret.length - 1] == 0 && ret.length > 1) ret.length--;
  return ret;
}
int BigInteger::operator%(const int &b) const {
  long long d = 0;
  for (int i = length - 1; i >= 0; --i) {
    d = ((d * (9999 + 1)) % b + a[i]) % b;
  }
  return (int)d;
}
BigInteger BigInteger::operator^(const int &n) const {
  BigInteger t, ret(1);
  if (n < 0) exit(-1);
  if (n == 0) return 1;
  if (n == 1) return *this;
  int m = n;
  while (m > 1) {
    t = *this;
    int i;
    for (i = 1; (i << 1) <= m; i <<= 1) {
      t = t * t;
    }
    m -= i;
    ret = ret * t;
    if (m == 1) ret = ret * (*this);
  }
  return ret;
}
bool BigInteger::operator>(const BigInteger &T) const {
  int ln;
  if (length > T.length)
    return true;
  else if (length == T.length) {
    ln = length - 1;
    while (a[ln] == T.a[ln] && ln >= 0) ln--;
    if (ln >= 0 && a[ln] > T.a[ln])
      return true;
    else
      return false;
  } else
    return false;
}
bool BigInteger::operator>(const int &t) const {
  BigInteger b(t);
  return *this > b;
}
void BigInteger::print() {
  printf("%d", a[length - 1]);
  for (int i = length - 2; i >= 0; --i) {
    printf("%04d", a[i]);
  }
  puts("");
}
};  // namespace BigNum
namespace IO_Optimize {
template <class T>
inline T &RD(T &);
template <class T>
inline T &RDD(T &);
inline long long RD() {
  long long x;
  return RD(x);
}
inline long long RDD() {
  long long x;
  return RDD(x);
}
inline double &RF(double &);
inline double RF() {
  double x;
  return RF(x);
}
template <class T0, class T1>
inline T0 &RD(T0 &x0, T1 &x1) {
  RD(x0), RD(x1);
  return x0;
}
template <class T0, class T1, class T2>
inline T0 &RD(T0 &x0, T1 &x1, T2 &x2) {
  RD(x0), RD(x1), RD(x2);
  return x0;
}
template <class T0, class T1, class T2, class T3>
inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3) {
  RD(x0), RD(x1), RD(x2), RD(x3);
  return x0;
}
template <class T0, class T1, class T2, class T3, class T4>
inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4) {
  RD(x0), RD(x1), RD(x2), RD(x3), RD(x4);
  return x0;
}
template <class T0, class T1, class T2, class T3, class T4, class T5>
inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {
  RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5);
  return x0;
}
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
inline T0 &RD(T0 &x0, T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5, T6 &x6) {
  RD(x0), RD(x1), RD(x2), RD(x3), RD(x4), RD(x5), RD(x6);
  return x0;
}
template <class T0, class T1>
inline void RDD(T0 &a, T1 &b) {
  RDD(a), RDD(b);
}
template <class T0, class T1, class T2>
inline void RDD(T0 &a, T1 &b, T2 &c) {
  RDD(a), RDD(b), RDD(c);
}
inline double &RF(double &a, double &b) {
  RF(a), RF(b);
  return a;
}
inline double &RF(double &a, double &b, double &c) {
  RF(a), RF(b), RF(c);
  return a;
}
inline double &RF(double &a, double &b, double &c, double &d) {
  RF(a), RF(b), RF(c), RF(d);
  return a;
}
inline double &RF(double &a, double &b, double &c, double &d, double &e) {
  RF(a), RF(b), RF(c), RF(d), RF(e);
  return a;
}
inline double &RF(double &a, double &b, double &c, double &d, double &e,
                  double &f) {
  RF(a), RF(b), RF(c), RF(d), RF(e), RF(f);
  return a;
}
inline double &RF(double &a, double &b, double &c, double &d, double &e,
                  double &f, double &g) {
  RF(a), RF(b), RF(c), RF(d), RF(e), RF(f), RF(g);
  return a;
}
template <class T>
inline T &RD(T &x) {
  char c;
  while (!isdigit((c = getchar())))
    ;
  x = c - '0';
  while (isdigit((c = getchar()))) x = x * 10 + c - '0';
  return x;
}
template <class T>
inline T &RDD(T &x) {
  char c;
  while ((c = getchar()), c != '-' && !isdigit(c))
    ;
  if (c == '-') {
    x = '0' - (c = getchar());
    while (isdigit((c = getchar()))) x = x * 10 + '0' - c;
  } else {
    x = c - '0';
    while (isdigit((c = getchar()))) x = x * 10 + c - '0';
  }
  return x;
}
inline double &RF(double &x) {
  char c;
  while ((c = getchar()), c != '-' && c != '.' && !isdigit(c))
    ;
  if (c == '-')
    if ((c = getchar()) == '.') {
      x = 0;
      double l = 1;
      while (isdigit((c = getchar()))) l /= 10, x = x * 10 + '0' - c;
      x *= l;
    } else {
      x = '0' - c;
      while (isdigit((c = getchar()))) x = x * 10 + '0' - c;
      if (c == '.') {
        double l = 1;
        while (isdigit((c = getchar()))) l /= 10, x = x * 10 + '0' - c;
        x *= l;
      }
    }
  else if (c == '.') {
    x = 0;
    double l = 1;
    while (isdigit((c = getchar()))) l /= 10, x = x * 10 + c - '0';
    x *= l;
  } else {
    x = c - '0';
    while (isdigit((c = getchar()))) x = x * 10 + c - '0';
    if (c == '.') {
      double l = 1;
      while (isdigit((c = getchar()))) l /= 10, x = x * 10 + c - '0';
      x *= l;
    }
  }
  return x;
}
};  // namespace IO_Optimize
namespace Debug {
void out(int *s, int n) {
  for (int i = 0; i <= n; i++) printf(i < n ? "%d " : "%d(--)\n", s[i]);
}
void out(long long *s, int n) {
  for (int i = 0; i <= n; i++) printf(i < n ? "%2lld " : "%2lld\n", s[i]);
}
void out(bool *s, int n) {
  for (int i = 0; i <= n; i++) printf(i < n ? "%2d " : "%2d\n", s[i] ? 1 : 0);
}
void out(int n) {
  for (int i = 0; i <= n; i++) printf(i < n ? "%2d " : "%2d\n", i);
}
};  // namespace Debug
using namespace Math;
using namespace Debug;
int num[100];
int div(int x) {
  int len = 0, p = 1;
  while (p * 2 < x) {
    num[len++] = p;
    p *= 2;
  }
  num[len++] = x - p + 1;
  return len;
}
const int maxn = 21234;
long long brr[maxn];
long long arr[maxn];
int main() {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  n *= 2;
  memset(arr, 0, sizeof(arr));
  memset(brr, 0, sizeof(brr));
  for (int i = 0; i <= b && i * 2 <= n; i++) brr[i] = 1;
  for (int i = 0; i <= a && i <= n; i++) {
    for (int j = i; j <= n; j++) {
      arr[j] += brr[j - i];
    }
  }
  long long ans = 0;
  for (int i = 0; i <= c && i * 4 <= n; i++) {
    ans += arr[n - i * 4];
  }
  cout << ans << endl;
  return 0;
}
