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(i)*500 for i in range(0,int(input())+1)]
B=[int(i)*100 for i in range(0,int(input())+1)]
C=[int(i)*50 for i in range(0,int(input())+1)]
X=int(input())  
l=[]
for a in A:
  for b in B:
    for c in C:
      l.append(a+b+c)
print(l.count(X))

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):

 
import math
import itertools
import sys
import copy
 




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())
count = 0
for i in range(A+1):
  for s in range(B+1):
    for o in range(C+1):
      if X == 500*i + 100*s + 50*o:
        count+=1
print(count)

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

N=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:
                N+=1

print(N)

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,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(i)*500 for i in range(0,int(input())+1)]
B=[int(i)*100 for i in range(0,int(input())+1)]
C=[int(i)*50 for i in range(0,int(input())+1)]
X=int(input())  
l=[]
for a in A:
  for b in B:
    for c in C:
      l.append(a+b+c)
print(l.count(X))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
tmp = 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:
                tmp+=1

print(tmp)

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

ans = 0
flag = 0

for i in range(a+1):
    tmp = x - i * 500
    if tmp < 0:
        break
    for j in range(b+1):
        tmp = x - i * 500
        tmp -= j * 100
        if tmp < 0:
            break
        elif tmp//50 <= c and tmp%50 == 0:
            ans += 1
print(ans)

Solution (Python):
a,b,c,x = map(int,[input() for i in range(4)])
cnt=0
for aa in range(a+1):
    for bb in range(b+1):
        for cc in range(c+1):
            if aa*500+bb*100+cc*50 == x:cnt+=1

print(cnt)

Solution (Python):
a,b,c,x = list(map(int,[input() for i in range(4)]))
cnt=0
for aa in range(a+1):
    for bb in range(b+1):
        for cc in range(c+1):
            if aa*500+bb*100+cc*50 == x:cnt+=1

print(cnt)

Solution (Python):
n=4
li=[int(input()) for i in range(n)]
a=li[0]
b=li[1]
c=li[2]
x=li[3]

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())

cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            ans = (500 * i) + (100 * j) + (50 * k)
            if ans == 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 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 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())

L = []

a = 0
b = 0
c = 0
count = 0

for i in range((X // 500) + 1):
    a = i
    for j in range(((X - 500 * i) // 100) + 1):
        b = j
        c = int((X - 500 * a - 100 * b) / 50)
        L.append([a, b, c])

for i in L:
    if i[0] <= A and i[1] <= B and i[2] <= C:
        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):
        if (x-500*i-100*j)%50==0 and (x-500*i-100*j)//50<=c and (x-500*i-100*j)>=0:
            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 += 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):
            y=500*i+100*j+50*k
            if y==x:
                ans+=1
print(ans)

Solution (Python):


a = int(input())
b = int(input())
c = int(input())
money = int(input())
count = 0

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
x //= 50
ans=0
for i in range(a+1):
    if 10*i<=x:
        for j in range(b+1):
            if 10*i+2*j<=x:
                if 10*i+2*j+c>=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):
            cnt = 500*i + 100*j + 50*k
            if cnt==x:
                ans+=1
print(ans)

Solution (Python):

import sys


def main(argv=sys.argv):
  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)
  
  return 0


if __name__ == '__main__':
  sys.exit(main())

Solution (Python):

import sys


def main(argv=sys.argv):

    number_of_500 = int(input())
    number_of_100 = int(input())
    number_of_50 = int(input())
    total_amount = int(input())

    number_of_cases = 0
    for counter_of_500 in range(number_of_500 + 1):
        for counter_of_100 in range(number_of_100 + 1):
            for counter_of_50 in range(number_of_50 + 1):
                if counter_of_500 * 500 + counter_of_100 * 100 + counter_of_50 * 50 \
                        == total_amount:
                    number_of_cases += 1

    print(number_of_cases)

    return 0


if __name__ == '__main__':
    sys.exit(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 n in range(C+1):
            if i*500+j*100+n*50 == X:
                count = count+1
print(count)

Solution (Python):
num500 = int(input())
num100 = int(input())
num50 = int(input())
amount = int(input())
rst = 0
for itr500 in range(num500+1):
    for itr100 in range(num100+1):
        for itr50 in range(num50+1):
            kingaku = itr50*50+itr100*100+itr500*500
            
            
            if(kingaku==amount):
                rst += 1
print(rst)

Solution (Python):


five_handred = int(input())
handred = int(input())
fifty = int(input())

target = int(input())

count = 0

for i in range(min(five_handred, int(target/500)) + 1):

    y = target - 500 * i

    for j in range(min(handred, int(y/100)) + 1):

        z = y - 100 * j

        if int(z/50) <= fifty:
            count += 1

        else:
            pass

print(count)

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

sum=0

d=int(x/500)

for i in range(min(a,d)+1):
    

    y=x-500*i

    e=int(y/100)
    for j in range(min(b,e)+1):
        
        z=y-100*j

        w=int(z/50)

        if w<=c:
            sum+=1
        else:
            pass

print(sum)

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 a*500+b*100+c*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 g in range(b + 1):
    for h in range(c + 1):
      if i*500 + g*100 + h*50 == 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 += 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 a*500 + b*100 + c*50 == X:
                count += 1
print(count)

Solution (Python):
import sys

a, b, c, x = map(int, sys.stdin.read().split())
x //= 50

def main():
    ways = 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:
                    ways += 1
    return ways

if __name__ == '__main__':
    ans = main()
    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):
    for k in range(c+1):
      if x==500*i+100*j+50*k:
        count+=1
print(count)

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

count = 0
for a_child in range(0, a + 1):
    x_child = x - 500 * a_child
    for b_child in range(0, b + 1):
        x_child_child = x_child - 100 * b_child
        for c_child in range(0, c + 1):
            x_child_child_child = x_child_child - 50 * c_child
            if x_child_child_child == 0:
                count += 1
                
            
print(count)

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 500 * i + 100* j + 50 * k == x:
        ans += 1
        
print(ans)

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

Solution (Python):
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())

def coin_check(coin_total, total):
    if coin_total==total:
        return 1
    else:
        return 0

count = 0
for i in range(coin_500 + 1):
    for j in range(coin_100 + 1):
        for k in range(coin_50 + 1):
            coin_total = i*500 + j*100 + k*50
            count+=coin_check(coin_total, total)
print(count)

Solution (Python):
u = [int(input()) for i in range(4)]
A,B,C,X = u[0],u[1],u[2],u[3]
count=[]
a ,b = 0,0
i = 0
while X-500*a >=0 and a<= A:
    X_1 = X-500*a
    while X_1-100*b>= 0 and b<= B:
        X_2 = X_1-100*b
        if X_2 % 50 == 0 and X_2 / 50 <= C:
            i += 1
        else:
             pass
        b += 1
    b = 0
    count.append(i)
    a += 1
    i=0
print(sum(count))

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 = int(input())
b = int(input())
c = int(input())
x = int(input())
s = 0
num = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      s = i*500+j*100+k*50
      if s == x:
        num += 1
      if s > x:
        break
    if s>x:
      continue
  if s>x:
    continue
print(num)

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

count = 0


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

print(count)

Solution (Python):
a,b,c,x=map(int,open(0).read().split())
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 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())

i = 0
j = 0
k = 0
list_all = []

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

print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
X = X/50
count = 0
sumA = 0
sumB = 0
sumC = 0
for i in range(A+1):
    sumA += 10*i
    for j in range(B+1):
        sumB =sumA + 2*j
        for k in range(C+1):
            sumC = sumB + k
            if sumC == X:
                count +=1
            sumC = 0
        sumB = 0
    sumA = 0
print(count)

Solution (Python):
num_Coin500 = int(input())
num_Coin100 = int(input())
num_Coin50 = int(input())
total = int(input())

count = 0

for i_Coin500 in range(num_Coin500 + 1):
    for i_Coin100 in range(num_Coin100 + 1):
        for i_Coin50 in range(num_Coin50 + 1):
            sum = 500*i_Coin500 + 100*i_Coin100 + 50*i_Coin50
            if total == sum:
                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())

ans = 0
for count500 in range(a+1):
    for count100 in range(b+1):
        value = 500 * count500 + 100 * count100
        delta = x - value
        if delta < 0:
            break

        if delta % 50 == 0 and delta // 50 <= c:
            ans += 1

print(ans)

Solution (Python):

fh = int(input())
oh = int(input())
ft = int(input())
om = int(input())
count = 0

for i in range(fh + 1):
    if om < i * 500:
        break
    for j in range(oh + 1):
        if om < i * 500 + j * 100:
            break
        for k in range(ft + 1):
            nm = 0
            nm = i * 500 + j * 100 + k * 50
            if om == nm:
                count +=1

print(count)

Solution (Python):
fh = int(input())
oh = int(input())
ft = int(input())
om = int(input())
count = 0

for i in range(fh + 1):
    for j in range(oh + 1):
        for k in range(ft + 1):
            nm = 0
            nm = i * 500 + j * 100 + k * 50
            if om == nm:
                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 (i*500)+(j*100)+(k*50)==x:
                ans+=1
print(ans)

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

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

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())
ans = 0
for na in range(a+1):
  for nb in range(b+1):
    for nc in range(c+1):
      if na*500 + nb*100 + nc*50 ==x:
        ans += 1
print(ans)

Solution (Python):

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


able_number=0

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

Solution (Python):
a, b, c, x = [int(input()) for p in range(4)]
counter = 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:
        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):
      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())

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, B, C, X = [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 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()) 
z = 0 
number = 0 
for i in range(a+1):
     for g in range(b+1):
         for h in range(c+1):
             z = 500*i + 100*g + 50*h
             if x == z:
                 number += 1  
print(number)

Solution (Python):
gohya =int(input())
hya = int(input())
goju = int(input())
total = int(input())
count = 0
for gh in range(gohya+1):
	for hy in range(hya+1):
		for gj in range(goju+1):
			if 500*gh + 100*hy + 50*gj == total:
				count += 1
print(count)

Solution (Python):

A = int(input())
B = int(input())
C = int(input())
X = int(input())
Ans = 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:
        Ans += 1
print(Ans)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
n=0
for x in range(A+1):
    for y in range(B+1):
        for z in range(C+1):
            if 500*x+100*y+50*z==X:
                n+=1
print(n)

Solution (Python):
a,b,c = int(input()),int(input()),int(input())
X = int(input())

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

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()) 

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):
li = [int(input()) for i in range(4)]
counter = 0
for p in range(li[0]+1):
  for q in range(li[1]+1):
    for r in range(li[2]+1):
      if 500*p+100*q+50*r == li[3]:
        counter+=1
print(counter)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
v = 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 == v:
        ans += 1

print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
v = 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 == v:
        ans += 1

print(ans)

Solution (Python):
number = [int(input()) for i in range(3)]  
x = int(input())   

a=0
b=0
c=0
ans = 0

for i in range(number[0]+1):
    a = i
    for k in range(number[1]+1):
        b = k
        for l in range(number[2]+1):
            c = l 
            if x ==500*a + 100*b + 50*c:
                ans += 1
            else:
                pass

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 += 1
print(ans)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, X: int):
    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)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    X = int(next(tokens))  
    solve(A, B, C, X)

if __name__ == '__main__':
    main()

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):
      p = i * 500 + j * 100 + k * 50
      if p > x:
        break
      if p == 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):
      num = x - 500 * i - 100 * j - 50 * k
      if num == 0:
        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 X == 500*i+100*j+50*k:
                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+=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):
c500 = int(input())
c100 = int(input())
c50 = int(input())
price = int(input())
ans = 0

for i in range(c500+1):
    for j in range(c100+1):
        for k in range(c50+1):
            if 500*i + 100*j + 50*k == price:
                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 == i*500+j*100+k*50:
                cnt += 1
print(cnt)

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, B, C, X = map(int,open(0).read().split())
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())
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())
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_a in range(a+1):
    for i_b in range(b+1):
        for i_c in range(c+1):
            sum = 500 * i_a + 100 * i_b + 50 * i_c
            if sum == x:
                ans += 1

print(ans)

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

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


print(n)

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

ans = 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:
                ans += 1
print(ans)

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

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

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):


A500 = int(input())
B100 = int(input())
C50 = int(input())
X = int(input())

num = 0 

for a500 in range(A500+1):
    sum500 = a500 * 500
    
    if sum500 > X:
        break
    elif sum500 == X:
        num += 1
        
        break

    for b100 in range(B100+1):
        sum100 = sum500 + b100 * 100
        
        if sum100 > X:
            break
        elif sum100 == X:
            num += 1
            
            break

        for c50 in range(C50+1):
            sum50 = sum100 + c50 * 50
            
            if sum50 > X:
                break
            elif sum50 == X:
                num += 1
                
                break

print(num)

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

for i in range(0,A+1):
    Y=X-500*i
    for j in range(0,B+1):
        Z=Y-100*j
        for k in range(0,C+1):
            W=Z-50*k
            if W==0:

                num=num+1
            else: 
                num=num+0
print(num)

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_num = int(input())
B_num = int(input())
C_num = int(input())
X_value = int(input()) 

A_value = 500
B_value = 100
C_value = 50

counter = 0
for i in range(A_num+1):
    remain_value1 = X_value - i * A_value
    if remain_value1 == 0:
        counter += 1
    elif remain_value1 < 0:
        break
    else:
        for j in range(B_num+1):
            remain_value2 = remain_value1 - j * B_value
            if remain_value2 == 0:
                counter += 1
            elif remain_value2 < 0:
                break
            else:
                for k in range(C_num+1):
                    remain_value3 = remain_value2 - k * C_value
                    if remain_value3 == 0:
                        counter += 1
                    elif remain_value3 < 0:
                        break
            
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):
            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())
cnt = 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:
				cnt += 1
print (cnt)

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


result=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:
                result+=1

print(result)

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()) for _ in range(4)]

x = x // 50
if 10 * a + 2 * b + c < x:
    print(0)
    quit()

n = 0
for i in range(x // 10, -1, -1):
    if i <= a:
        x1 = x - 10 * i
        for j in range(x1 // 2, -1, -1):
            if j <= b and x1 - 2 * j <= c:
                n += 1
print(n)

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

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):
import itertools

cnt_500 = int(input())
cnt_100 = int(input())
cnt_50 = int(input())
target_amount = int(input())

cnt_500_arr = [i for i in range(cnt_500+1)]
cnt_100_arr = [i for i in range(cnt_100+1)]
cnt_50_arr = [i for i in range(cnt_50+1)]

coin_combinations = list(itertools.product(cnt_500_arr, cnt_100_arr, cnt_50_arr))

result_count = 0
for cnt_500, cnt_100, cnt_50 in coin_combinations:
	amount = cnt_500 * 500 + cnt_100 * 100 + cnt_50 * 50
	if amount == target_amount:
		result_count += 1
print(result_count)

Solution (Python):

A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for coin500 in range(A + 1):
 for coin100 in range(B + 1):
  for coin50 in range(C + 1):
   if coin50 * 50 + coin100 * 100 + coin500 * 500 == X:
    cnt += 1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for coin500 in range(A + 1):
    for coin100 in range(B + 1):
        for coin50 in range(C + 1):
            if coin50 * 50 + coin100 * 100 + coin500 * 500 == X:
                cnt += 1
print(cnt)

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 a*500+b*100+c*50 == X:
                ans += 1

print(ans)