Problem:
 Score : 200 points    Problem Statement You have A  500 -yen coins, B  100 -yen coins and C  50 -yen coins (yen is the currency of Japan).
In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.      Constraints  0 \leq A, B, C \leq 50  A + B + C \geq 1  50 \leq X \leq 20  000  A , B and C are integers.  X is a multiple of 50 .         Input Input is given from Standard Input in the following format:  A  B  C  X       Output Print the number of ways to select coins.        Sample Input 1 2
2
2
100      Sample Output 1 2  There are two ways to satisfy the condition:   Select zero 500 -yen coins, one 100 -yen coin and zero 50 -yen coins.  Select zero 500 -yen coins, zero 100 -yen coins and two 50 -yen coins.        Sample Input 2 5
1
0
150      Sample Output 2 0  Note that the total must be exactly X yen.       Sample Input 3 30
40
50
6000      Sample Output 3 213

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())


def calc(val):
    pass
def main():
    cnt = 0
    ans = 0
    for i in range(C+1):
        ans_C = X - i*50
        if ans_C == 0:
            cnt+=1
            break
        elif ans_C < 0:
            break
        else:
            pass

        for j in range(B+1):
            ans_B = ans_C - j*100
            if ans_B == 0:
                cnt+=1
                break
            elif ans_B < 0:
                break
            else:
                pass

            for k in range(A+1):
                ans_A = ans_B - k*500
                if ans_A == 0:
                    cnt+=1
                    break
                elif ans_A < 0:
                    break
                else:
                    pass
    
    print(cnt)

                
if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

Count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if(500*i+100*j+50*k == X):
        Count = Count + 1
print(Count)

Solution (Python):
A=(int)(input())
B=(int)(input())
C=(int)(input())
X=(int)(input())

count = 0
a_ = X//500
if a_>A:
    a_ = A
for a in range(a_+1):
    x_ = X-a*500
    b_ = x_//100
    if b_>B:
        b_ = B
    for b in range(b_+1):
        x = x_-b*100
        c_ = x//50
        if c_<=C and c_>=0:
            count = count + 1

print(count)

Solution (Python):
def solve():
    x, y, z, n = [int(input()) for _ in range(4)]
    ans = 0
    for i in range(x+1):
        for j in range(y+1):
            for k in range(z+1):
                if 500 * i + 100 * j + 50 * k == n:
                    ans += 1
    return ans

print(solve())

Solution (Python):
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    target = int(input())
    answer = 0
    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
                if 500 * i + 100 * j + 50 * k == target:
                    answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):


import sys
input = sys.stdin.readline

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    ans = 0
    for i in range(a+1):
        if 500 * i > x:
            break
        for j in range(b+1):
            if 500 * i + 100 * j > x:
                break
            for k in range(c+1):
                if 500 * i + 100 * j + 50 * k > x:
                    break
                if 500 * i + 100 * j + 50 * k == x:
                    ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
lst=[]
A=int(input())
B=int(input())
C=int(input())
X=int(input())//50
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 10*a+2*b+c==X:
                lst.append([a,b,c])
print(len(lst))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (i*500 + j*100 + k*50) == X:
                ans += 1
print(ans)

Solution (Python):
A = int(input())  
B = int(input())  
C = int(input())  
X = int(input())

count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if 500 * a + 100 * b + 50 * c == X:
                count += 1
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0

for x in range(0, A+1):
  for y in range(0, B+1):
    for z in range(0, C+1):
      if x*500 + y*100 + z*50 == X:
        count +=1
      
print(count)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                cnt+=1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
answer = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500 * i + 100 * j + 50 * k == X:
                answer += 1

print(answer)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500 * i + 100 * j + 50 * k == X:
                ans += 1
print(ans)

Solution (Python):
a= int(input())
b= int(input())
c= int(input())
x= int(input())
ans=0
for i in range (a+1):
    for j in range (b+1):
        for k in range (c+1):
            if 500*i+100*j+50*k == x:
                ans = ans + 1
            else:
                pass
print(ans)

Solution (Python):
a = input()
b = input()
c = input()
d = input()
x = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500*i + 100*j + 50*k == d:
                x += 1
print x

Solution (Python):
a = input()
b = input()
c = input()
x = input()
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                ans += 1
print ans

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
total = 0
cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total = 500*i+100*j+50*k
            if total == x:
                cnt += 1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for ia in range(A+1):
    for ib in range(B+1):
        for ic in range(C+1):
            if 500*ia+100*ib+50*ic == X:
                cnt = cnt + 1

print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())

X = int(input())

count = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if 500*a + 100*b + 50*c ==X:
                count += 1


print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for a in range(a+1):
    for b in range(b+1):
        for c in range(c+1):
            if (500*a) + (100*b) + (50*c) == x:
                cnt += 1

print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                count += 1
print(count)

Solution (Python):
a= int(input())
b= int(input())
c= int(input())
x= int(input())
ans=0
for i in range (a+1):
    for j in range (b+1):
        for k in range (c+1):
            if 500*i+100*j+50*k == x:
                ans = ans + 1
            else:
                pass
print(ans)

Solution (Python):
import  numpy

A = int(input())
B = int(input())
C = int(input())
X = int(input())

lisA=list(range(A+1))
lisB=list(range(B+1))
lisC=list(range(C+1))

vA=numpy.repeat(lisA, len(lisB)*len(lisC))
vB=numpy.repeat(len(lisA)*lisB, len(lisC))
vC=numpy.repeat(len(lisA)*len(lisB)*lisC,1)


O = numpy.matrix([500,100,50])
P = numpy.array([vA,vB,vC]).reshape(3,len(vA))
Q = O*P
ans=numpy.sum(Q==X)

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0



for i in range(A+1):
    for k in range(B+1):
        for j in range(C+1):
            total = i * 500 + 100 * k + j * 50
            if(total == X):
                ans = ans + 1

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for a in range(A+1):
    tmp_a = X - a * 500
    if tmp_a == 0:
        ans += 1
        continue
    elif tmp_a < 0:
        break
    else:
        for b in range(B+1):
            tmp_b = tmp_a - b * 100
            if tmp_b == 0:
                ans += 1
                continue
            elif tmp_b < 0:
                break
            else:
                for c in range(C+1):
                    tmp_c = tmp_b - c * 50
                    if tmp_c == 0:
                        ans += 1
                        continue
                    elif tmp_b < 0:
                        break

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if (500 * a) + (100 * b) + (50 * c) == X:
                cnt += 1

print(cnt)

Solution (Python):
N=[]
counter=0
for i in range(4):
  N.append(int(input()))

for a in range(N[0]+1):
  for b in range(N[1]+1):
    for c in range(N[2]+1):
      if 500*(a)+100*(b)+50*(c)==N[3]:
        counter+=1
print(counter)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total=500*i+100*j+50*k
            if total==x:
                cnt=cnt+1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if (i)*500+(j)*100+(k)*50 == X:
        count += 1
      else:
        pass
print(count)

Solution (Python):
a, b, c, x = [int(input()) for _ in range(4)]
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500 * i + 100 * j + 50 * k == x:
                ans += 1
print(ans)

Solution (Python):




def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    result = 0
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(C + 1):
                if a * 500 + b * 100 + c * 50 == X:
                    result += 1
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
cnt = 0
 
for a in range(0,A+1):
  for b in range(0,B+1):
    for c in range(0,C+1):
      if a*500+b*100+c*50 == X:
        cnt +=1
 
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for m in range(c+1):
            if 500*int(i)+100*int(j)+50*int(m)==x:
                count+=1
print(count)

Solution (Python):

A = int(input())
B = int(input())
C = int(input())
X = int(input())


ans = 0
for a in range(A+1) :
    for b in range(B+1) :
        for c in range(C+1) :
            total = 500 * a + 100 * b + 50 * c
            if total == X :
                ans += 1

print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			if 500*i+100*j+50*k==x:
				cnt += 1
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for aa in range(a+1):
    for bb in range(b+1):
        for cc in range(c+1):
            if 500*aa + bb*100 +cc*50 ==x:
                ans += 1
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
num=0
for aa in range(a+1):
  for bb in range(b+1):
    for cc in range(c+1):
      total = 500*aa+ 100*bb+50*cc

      if total == x:
        num += 1
print(num)

Solution (Python):
A,B,C,X=[int(input()) for i in range(4)]
print([500*a+100*b+50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)].count(X))

Solution (Python):

def main(a,b,c,x):
    count = 0
    
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                p = (500*i) + (100*j) + (50*k)
                if p == x:
                    count += 1
    return count

a = int(input())
b = int(input())
c = int(input())
x = int(input())
print(main(a,b,c,x))

Solution (Python):
a,b,c,x = [int(input())+1 for _ in range(4)]
print(sum(10*i+2*j+k==x//50 for i in range(a) for j in range(b) for k in range(c)))

Solution (Python):
a = int(input());b = int(input());c = int(input());x = int(input())
s = 0
counter = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      s = 500*i + 100*j + 50*k
      if s == x:
        counter += 1

print(counter)

Solution (Python):
a = int(input());b = int(input());c = int(input());x = int(input())
s = 0
n = 0
counter = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      s = 500*i + 100*j + 50*k
      if s == x:
        counter += 1

print(counter)

Solution (Python):
[A, B, C, X] = list(map(int, [input() for i in range(4)]))
count = 0
for i in range(0, A+1):
  for j in range(0, B+1):
    for k in range(0, C+1):
      if (500*i + 100*j + 50*k) == X:
        count += 1

print(count)

Solution (Python):
A = int(input())  
B = int(input())  
C = int(input())  
X = int(input())  

ans = 0
for a in range(min(A+1, X//500+1)):
    x = X - 500 * a
    for b in range(min(B+1, X//100+1)):
        xx = x - 100 * b
        if (xx/50).is_integer() and xx//50 <= C and xx//50 >= 0:
            ans += 1
            
print(ans)

Solution (Python):
a,b,c,x = [int(input())+1 for _ in range(4)]
print(sum(10*i+2*j+k==x//50 for k in range(c) for j in range(b) for i in range(a)))

Solution (Python):
ans = 0
a,b,c,x = [int(input())+1 for _ in range(4)]
for i in range(a):
  for j in range(b):
    for k in range(c):
      if 10*i + 2*j + k == x//50:
        ans += 1
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt=0
for i500 in range(a+1):
    for i100 in range(b+1):
        for i_50 in range(c+1):
            if x==500*i500+100*i100+50*i_50:
                cnt+=1
            elif x<500*i500+100*i100+50*i_50:break
print(cnt)

Solution (Python):
ins = [int(input()) for i in range(4)]
cnt = 0
for i in range(ins[0]+1):
    for j in range(ins[1]+1):
        for k in range(ins[2]+1):
            if ins[3] == 500*i + 100*j + 50*k:
                cnt += 1
print(cnt)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for h in range(c+1):
            if 500*i+100*j+50*h==x:
                ans+=1
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for an in range(a+1):
    for bn in range(b+1):
        for cn in range(c+1):
            if 500*an + 100*bn + 50 * cn == x:
                ans += 1

print(ans)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
ans=0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            total=500*a+100*b+50*c
            if total==X:
                ans+=1

print(ans)

Solution (Python):
a =int(input())
b =int(input())
c =int(input())
x =int(input())

total=0
count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            total=500*i+100*j+50*k
            if total==x:
                count+=1
                
print(count)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if k*50 + j*100 + i*500 == x:
        ans += 1
print(ans)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]
print([500*a + 100*b + 50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)].count(X))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counts = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if (500*a + 100*b + 50*c) == X:
                counts += 1
                
print(counts)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for p in range(a + 1):
    for q in range(b + 1):
        r = (x - p * 500 - q * 100) // 50
        if 0 <= r <= c:
            ans += 1
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
d=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                d+=1
print(d)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
d=0
for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if 500*i+100*j+50*k==x:
                d+=1
            else:
                continue
    
print(d)

Solution (Python):
A_500 = int(input())
B_100 = int(input())
C_50 = int(input())
X = int(input())

count = 0

for i in range(0, A_500 + 1):
	for j in range(0, B_100 + 1):
		for k in range(0, C_50 + 1):
			if X == i * 500 + j * 100 + k * 50:
				count += 1

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for h in range(a +1):
    for i in range(b +1):
        for j in range(c +1):
            if h *500 + i *100 + j *50 == x:
                count += 1
print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k==x:
                count+=1
print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0

for i in range(a+1):
    oturi = x-500*i
    if oturi < 0:
        break
    else:
        for j in range(b+1):
            oturi_2 = oturi-100*j
            if oturi_2 < 0:
                break
            else:
                if oturi_2 // 50 <= c:
                    counter += 1
print(counter)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0

for i in range(a+1):
    oturi = x-500*i
    if oturi < 0:
        continue
    else:
        for j in range(b+1):
            oturi_2 = oturi-100*j
            if oturi_2 < 0:
                continue
            else:
                if oturi_2 // 50 <= c:
                    counter += 1
print(counter)

Solution (Python):
A,B,C,X = [int(input()) for _ in range(4)]
cnt = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a+100*b+50*c==X:
                cnt+=1
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + j*100 + 50*k == x:
                ans += 1
print(ans)

Solution (Python):
a,b,c,x=int(input()),int(input()),int(input()),int(input())
ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x:
        ans+=1
print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

counter = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (i*500+j*100+k*50) == X:
                counter += 1

print(counter)

Solution (Python):
l = [int(input()) for i in range(4)]
count = 0
for i in range(l[0]+1):
    for j in range(l[1]+1):
        for k in range(l[2]+1):
            if 500*i + 100*j + 50*k == l[3]:
                count += 1
print(count)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    A=INT()
    B=INT()
    C=INT()
    x=INT()
    ct=0
    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                if a*500+b*100+c*50==x:
                    ct+=1
    print(ct)
    
if __name__ == '__main__':
    do()

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      total=500*a+100*b+50*c
      if total==X:
        count+=1
        
print(count)

Solution (Python):
A,B,C,X=[int(input()) for i in range(4)]
print([500*a+100*b+50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)].count(X))

Solution (Python):
a,b,c,x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Solution (Python):
a = int (input())
b = int (input())
c = int (input())
x = int (input())

cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            
            if i*500 + j*100 + k*50 == x:
                cnt += 1
                
                
print(cnt)

Solution (Python):
a_num = int(input())
b_num = int(input())
c_num = int(input())
x = int(input())

total = []

for a in range(0, a_num+1):
  for b in range(0, b_num+1):
    for c in range(0, c_num+1):
      total.append(a*500+b*100+c*50)

print(total.count(x))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
a = X // 500
b = X // 100
c = X // 50
xflag = False
yflag = False
zflag = False
for i in range(a+1):
    x = 500*i
    if i > A:
        continue
    for j in range(b+1):
        y = 100*j
        if j > B:
            continue
        for k in range(c+1):
            z = 50*k
            if k > C:
                continue
            s = x+y+z
            if s==X:
                ans += 1
print(ans)

Solution (Python):
l = [int(input()) for i in range(3)]
x = int(input())
count = 0
for i in range(l[0]+1):
  for j in range(l[1]+1):
    for k in range(l[2]+1):
      if 500*i+100*j+50*k == x:
        count += 1
print(count)

Solution (Python):
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    cnt = 0
    for ia in range(A+1):
        for ib in range(B+1):
            for ic in range(C+1):
                if 500*ia + 100*ib + 50*ic == X: cnt +=1

    print(cnt)    

if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500+ j*100 + k*50 == x:
        count += 1
print(count)

Solution (Python):
a, b, c, x = int(input()), int(input()), int(input()), int(input())//50
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 10*i + 2*j + k == x:
        ans += 1
        
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500 * i + 100 * j + 50 * k:
                cnt += 1

print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i + 100*j + 50*k == X:
                count += 1 
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i1 in range(A+1):
    for i2 in range(B+1):
        for i3 in range(C+1):
            if (i1*500 + i2*100 + i3 *50) == X:
                count += 1
print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                cnt += 1
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
res = 0

for ai in range(a + 1):
  for bi in range(b + 1):
    for ci in range(c + 1):
      total = 500 * ai + 100 * bi + 50 * ci
      if x == total:
        res += 1
        
print(res)

Solution (Python):
coin=[]
for i in range(4):
	coin.append(int(input()))
count=0
for i in range(coin[0]+1):
	for j in range(coin[1]+1):
		for k in range(coin[2]+1):
			if i*500+j*100+k*50==coin[3]:
				count+=1
print(count)

Solution (Python):
n_500 = int(input())
n_100 = int(input())
n_50  = int(input())
X     = int(input())

n_comb = 0
for i in range(n_500+1):
  for j in range(n_100+1):
    for k in range(n_50+1):
      comb = i*500 + j*100 + k*50
      if X == comb:
        n_comb += 1
print(n_comb)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0 
for i in range(A + 1):
  for j in range(B + 1):
    for k in range(C + 1):
      if 500 * i + 100 * j + 50 * k == X:
        count += 1

print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count=0
sum=0
for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            sum = 500*a + 100*b +50*c
            if X == sum:
                count+=1
            sum=0
print(count)

Solution (Python):
def solve(a, b, c, x):
    return sum(
        x == 500 * i + 100 * j + 50 * k
        for i in range(a + 1) 
        for j in range(b + 1) 
        for k in range(c + 1) 
    )

_a = int(input())
_b = int(input())
_c = int(input())
_x = int(input())
print(solve(_a, _b, _c, _x))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = 500 * i + 100 * j + 50 * k
            if sum == X:
                count += 1

print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

sum_pair = 0

for a in range(A + 1):
    for b in range(B + 1):
        c = (X - a * 500 - b * 100) / 50
        if c >= 0 and c <= C:
            sum_pair += 1

print(sum_pair)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a + 100*b + 50*c == X:
                ans += 1
print(ans)

Solution (Python):
A, B, C, X = int(input()), int(input()), int(input()), int(input())

X //= 50
answer = 0
for a in range(A + 1):
  if a * 10 > X:
    continue
  for b in range(B + 1):
    if a * 10 + b * 2 > X:
      continue
    for c in range(C + 1):
      if a * 10 + b * 2 + c == X:
        answer += 1

print(answer)

Solution (Python):
A, B, C, X = int(input()), int(input()), int(input()), int(input())

X //= 50
answer = 0
for a in range(A + 1):
  if a * 10 > X:
    continue
  for b in range(B + 1):
    for c in range(C + 1):
      if a * 10 + b * 2 + c == X:
        answer += 1

print(answer)

Solution (Python):
A, B, C, X = int(input()), int(input()), int(input()), int(input())

answer = 0
for a in range(A + 1):
  for b in range(B + 1):
    for c in range(C + 1):
      if a * 500 + b * 100 + c * 50 == X:
        answer += 1

print(answer)

Solution (Python):

a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a + 1):
    for j in range(b + 1):
        for h in range(c + 1):
            if 500 * i + 100 * j + 50 * h == x:
                ans += 1
                
print(ans)

Solution (Python):




a = int(input())
b = int(input())
c = int(input())
x = int(input())


ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans = ans + 1


print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range (A+1):
	for j in range (B+1):
		tmp = i*500 + j*100
		
		k = (X-tmp) / 50
		if k>=0 and k <= C:
			count +=1
print(count)

Solution (Python):
a,b,c,x=[int(input()) for _ in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(x))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
L = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*(i)+100*(j)+50*(k) == X:
                L += 1

print(L)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (500*i+100*j+50*k)==X:
                    count=count+1
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if (500 * i + 100 * j + 50 * k) == X:
                count += 1


print(count)

Solution (Python):
A = int(input())  
B = int(input())  
C = int(input())  
X = int(input())  

c = 0
for i in range(C+1):
    for j in range(B+1):
        for k in range(A+1):
            if (50 * i) + (100 * j) + (500 * k) == X:
                c += 1
print(c)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]

ans = 0
for a in range(A + 1):  
    for b in range(B + 1):
        for c in range(C + 1):
            if a * 500 + b * 100 + c * 50 == X:
                ans += 1
print(ans)

Solution (Python):
a, b, c, x = [int(input()) for _ in range(4)]

count = 0
for i in range(a, -1, -1):
    i_tmp = i * 500
    if i_tmp > x:
        continue
    for j in range(b, -1, -1):
        j_tmp = j * 100 + i_tmp
        if j_tmp > x:
            continue
        for k in range(c, -1, -1):
            sum = k * 50 + j_tmp
            if sum == x:
                count += 1

print(count)

Solution (Python):
a, b, c, x = [int(input()) for _ in range(4)]

count = 0
for i in range(a, -1, -1):
    i_tmp = i * 500
    for j in range(b, -1, -1):
        j_tmp = j * 100 + i_tmp
        for k in range(c, -1, -1):
            sum = k * 50 + j_tmp
            if sum == x:
                count += 1

print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())


x = 0


count = 0

for a in range(A + 1):
    x = a * 500
    for b in range(B + 1):
        x = a * 500 + b * 100
        for c in range(C + 1):
            x = a * 500 + b * 100 + c * 50
            if x == X:
                count += 1
print(count)

Solution (Python):
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B, C, X = map(int, read().split())

ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if X == 500 * i + 100 * j + 50 * k:
                ans += 1
print(ans)