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

class Latb:
	def __init__(self,t,l,h):
		self.t=t
		self.l=l
		self.h=h
		
	def __repr__(self):
		return 'TLH:'+str(self.t)+' '+str(self.l)+' '+str(self.h)
		
	def __eq__(self,th):
		return self.t==th.t and self.l==th.l and self.h==th.h
		
	def __hash__(self):
		return hash(self.t)+hash(self.l)+hash(self.h)
		
	def ttl(self):
		if self.t==0:
			return 0
		else:
			self.t-=1
			self.l+=2
			return 1
			
	def lth(self):
		if self.l==0:
			return 0
		else:
			self.l-=1
			self.h+=2
			return 1
			
	def mm(self):
		if self.lth():
			return 1
		elif self.ttl():
			return 1
		else:
			return 0

def gen(n):
	l=n%2
	t=n//2
	return Latb(t,l,0)

def ttl(lt):
	if lt.t==0:
		return 0
	else:
		lt.t-=1
		lt.l+=2
		return 1
		
def cln(lt):
	return Latb(lt.t,lt.l,lt.h)

def glatb(n):
	lt=gen(n)
	v=[]
	v.append(cln(lt))
	while ttl(lt):
		v.append(cln(lt))
	return v
	
def icr(lt,mlt):
	return lt.t<=mlt.t and lt.l<=mlt.l and lt.h<=mlt.h


def cav(n,mlt):
	v=glatb(n)
	sv=set()
	cv=v.copy()
	for c in cv:
		if icr(c,mlt):
			sv.add(cln(c))
		while c.mm():
			if icr(c,mlt):
				sv.add(cln(c))
	#print(sv)
	return len(sv)
	
n,t,l,h=map(int,input().split(' '))
mlt=Latb(t,l,h)
print(cav(n,mlt))