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

import java.io.*;
import java.util.*;
public class Answer44B{
    public static void main(String[] args){
	BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
	new Kai(reader).solve();
    }
}
class Kai{
    BufferedReader reader;
    public Kai(BufferedReader reader){
	this.reader=reader;
    }
    public void solve(){
	//TODO
	String[] tmp=read().split(" ");
	int n=to_i(tmp[0])*2;
	int[] a={to_i(tmp[1]),to_i(tmp[2]),to_i(tmp[3])};
	int[] b={1,2,4};
	int[][] memo=new int[n+1][4];
	memo[0][0]=1;
	for(int i=0;i<n;i++){
	    for(int j=0;j<3;j++){
		for(int k=0;k<=a[j];k++){
		    if(i+k*b[j]<=n){
			memo[i+k*b[j]][j+1]+=memo[i][j];
		    }
		}
	    }
	}
	pln(memo[n][3]);
    }
    //tools//////////////////////////////////////////////////
    public String read(){
	String s=null;
	try{
	    s=reader.readLine();
	}catch(IOException e){
	    e.printStackTrace();
	}
	return s;
    }
    public int[] to_i(String[] s){
	int[] tmp=new int[s.length];
	for(int i=0;i<s.length;i++){
	    tmp[i]=to_i(s[i]);
	}
	return tmp;
    }
    public long[] to_l(String[] s){
	long[] tmp=new long[s.length];
	for(int i=0;i<s.length;i++){
	    tmp[i]=to_l(s[i]);
	}
	return tmp;
    }
    public int to_i(String s){
	return Integer.parseInt(s);
    }
    public long to_l(String s){
	return Long.parseLong(s);
    }
    public void p(Object s){
	System.out.print(s);
    }
    public void pln(Object s){
	System.out.println(s);
    }
    public void debug(Object s){
	System.err.print(s);
    }
    public void debugln(Object s){
	System.err.println(s);
    }
}