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>
using namespace std;
const long long M = 1e9 + 7;
long long mul(long long x, long long y) { return ((x % M) * (y % M) % M); }
long long binpow(long long x, long long y) {
  long long z = 1;
  while (y) {
    if (y & 1LL) z = mul(z, x);
    x = mul(x, x);
    y >>= 1LL;
  }
  return z;
}
long long inv(long long x) { return binpow(x, M - 2); }
long long divide(long long x, long long y) { return mul(x, inv(y)); }
const int N = 20005;
int n, a[3];
long long dp[N];
void solve() {
  long long ans = 0;
  for (int i = 0; i <= a[0]; ++i) {
    for (int j = i; j <= a[1]; ++j) {
      if ((n - (i / 2 + j)) % 2 == 0 && (n - (i / 2 + j)) / 2 < a[2]) ++ans;
    }
  }
  cout << ans << "\n";
}
void input() { cin >> n >> a[0] >> a[1] >> a[2]; }
void test_case() {
  input();
  solve();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int q, multicase = 0;
  if (multicase)
    cin >> q;
  else
    q = 1;
  for (int i = 1; i <= q; ++i) test_case();
}
