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;
set<string> q;
string p(int x) {
  string s = "";
  if (x == 0) s = '0';
  while (x != 0) {
    string ch;
    ch = (x % 10) + '0';
    s = ch + s;
    x = x / 10;
  }
  return s;
};
int n, a, b, c;
void rec(int x, int y, int z) {
  string s = "", s1, s2, s3;
  s1 = p(x);
  s2 = p(y);
  s3 = p(z);
  s = s1 + ' ' + s2 + ' ' + s3;
  if (q.find(s) != q.end()) return;
  q.insert(s);
  if (y + 2 <= b && z > 0) rec(x, y + 2, z - 1);
  if (x + 2 <= a && y > 0) rec(x + 2, y - 1, z);
}
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &c);
  n *= 2;
  int x = 0, y = 0, z = 0;
  int sum = 0;
  while (sum < n) {
    int sumo = sum;
    if (sum + 4 <= n && z < c) {
      sum += 4;
      z++;
    } else if (sum + 2 <= n && y < b) {
      sum += 2;
      y++;
    } else if (sum + 1 <= n && x < a) {
      sum += 1;
      x++;
    }
    if (sumo == sum) {
      printf("0\n");
      return 0;
    }
  }
  rec(x, y, z);
  printf("%d\n", q.size());
  return 0;
}
