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, b, c, x = [int(input()) for i in range(4)]

same_count = 0
for a_i in range(a+1):
    for b_i in range(b+1):
        for c_i in range(c+1):
            if 500*a_i + 100*b_i + 50*c_i == x:
                same_count += 1

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

print(ans)

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

Solution (Python):
coin=[int(input()) for i in range(3)]
x=int(input())
c=0
for i in range(coin[0]+1):
    if 500*i>x:break
    else:
        for j in range(coin[1]+1):
            if 500*i+100*j>x:break
            else:
                for k in range(coin[2]+1):
                    t=500*i+100*j+k*50
                    if t>x:break
                    elif t==x:c+=1
print(c)

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 n in range(A+1):
  for m in range(B+1):
    for l in range(C+1):
      if X==500*n+100*m+50*l:
        cnt+=1

print(cnt)

Solution (Python):


def main():
    
    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)

if __name__ == '__main__':
    main()

Solution (Python):


def solve():
    y500, y100, y50, n = [int(input()) for _ in [0]*4]

    ans = 0
    for i in range(y500+1):
        for j in range(y100+1):
            for k in range(y50+1):
                ans += [0,1][500*i+100*j+50*k==n]
    print(ans)

if __name__=="__main__":
    solve()

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

N = 0
a = b = c = 0

for c in range(C+1):
    if (X-50*c)%100 == 0:
        for b in range(B+1):
            if (X-50*c-100*b)%500 == 0:
                if 0<= int((X-50*c-100*b)/500) <= A:
                    N += 1

print(N)

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)

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

print(counter)

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

print(ans)

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

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):
			y = 500*a + 100*b + 50*c
			if (y == X):
				count += 1

print(count)

Solution (Python):


if __name__ == '__main__':
    A = int(input()) 
    B = int(input()) 
    C = int(input()) 
    X = int(input())

    ans = 0
    for i_500 in range(A+1):
        sum500 = 500*i_500
        if sum500 > X: break
        for i_100 in range(B+1):
            sum500_100 = 500*i_500+100*i_100 
            if sum500_100 > X: break
            for i_50 in range(C+1):
                sum500_100_50 = 500*i_500 + 100*i_100 + 50*i_50
                if sum500_100_50 > X:
                    break
                if sum500_100_50 == X:
                    ans += 1
                    break
    print(ans)

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

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(), 10)
b = int(input(), 10)
c = int(input(), 10)
x = int(input(), 10)
ptn = 0

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

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

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

print(ans)

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

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

Solution (Python):
A, B, C, X = [int(input()) for i in range(4)]
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):
import numpy as np

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

fifty = np.array([i for i in range(int(C)+1)])

hun = np.array([100 * i + 50 * fifty for i in range(int(B)+1)])

hun_r = np.ravel(hun)

f_hun = np.array([500 * i + hun_r for i in range(int(A)+1)])

print(len(f_hun[f_hun == int(X)]))

Solution (Python):
"""a=int(input())
b=int(input())
c=int(input())
x=int(input())
d=[]






    
    for i in range(min(a,x//500)+1):
        p=x-500*i
        for j in range(min(b,p//100)+1):
            q=p-100*j
            for k in range(min(c,q//50)+1):
                r=q-50*k
                if p*q*r==0 and not (p<0 or q<0 or r<0) :
                    
                    d.append([i,j,k])
                    
                    
    
    

    
    print(len(d))"""

a=int(input())
b=int(input())
c=int(input())
x=int(input())
d=[]
for i in range(min(a,x//500)+1):
        p=x-500*i
        for j in range(min(b,p//100)+1):
            q=p-100*j
            for k in range(min(c,q//50)+1):
                r=q-50*k
                if p*q*r==0 and not (p<0 or q<0 or r<0) :
                    
                    d.append([i,j,k])
                    
                    
    
    

    
print(len(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 += 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 i in range(0,A+1):
    for j in range (0,B+1):
        for k in range(0,C+1):
            tmp = i* 500 + j* 100 + k*50
            if tmp == X:
                ans +=1;
print(ans)

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

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

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count=0
for a in [a*500 for a in range(A + 1)]:
    for j in range(B + 1):
        for k in range(C + 1):
            if a + 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 += 1
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = 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):
            if 500*i + 100*j + 50*k == X:
                res += 1
print(res)

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 ai in range(a + 1):
    for bi in range(b + 1):
        for ci in range(c + 1):
            if (500 * ai + 100 * bi + 50 * ci == x):
                cnt += 1
print(cnt)

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

print count

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):
        temp = x - 500 * i - 100 * j
        if 0 <= temp and temp <= 50 * c:
            answer += 1
print(answer)

Solution (Python):
five = int(input())
hund = int(input())
fif = int(input())

count = 0
total = int(input())

goukei = five + hund + fif 

lis = []
for f in range(five+1):
    for h in range(hund+1):
        for i in range(fif+1):
            lis.append(f*500+h*100+i*50)


for li in lis:
    if total == li:
        count += 1
print(count)

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

can_count = 0

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

print(can_count)

Solution (Python):

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

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

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

Solution (Python):
from itertools import product
A = int(input())
B = int(input())
C = int(input())
X = int(input())
print(len([True for a,b,c in product(range(A+1),range(B+1),range(C+1)) if 500*a + 100*b + 50*c == X]))

Solution (Python):
A=int(raw_input())
B=int(raw_input())
C=int(raw_input())
X=int(raw_input())
cnt = 0
for a in xrange(0,1+A):
  for b in xrange(0,1+B):
    for c in xrange(0,1+C):
      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())

result = 0
for n500 in range(A+1):
    for n100 in range(B+1):
        for n50 in range(C+1):
            if n500*500 + n100*100 + n50*50 == X:
                result += 1
print(result)

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

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

Solution (Python):
from itertools import product

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

print(sum(A*500+B*100+C*50==x for A, B, C in product(range(a+1), range(b+1), range(c+1))))

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

count = 0

for ac in range(A+1):
    for bc in range(B+1):
        for cc in range(C+1):
            if 500*ac+100*bc+50*cc == 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):
            sum = 500*i + 100*j + 50*k
            if sum == X:
                cnt += 1

print(cnt)

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

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






cnt = 0
for i1 in range(0,a+1):
    for i2 in range(0,b+1):
        for i3 in range(0,c+1):
            s = 500*i1+100*i2+50*i3
            if(s==x):
                cnt = cnt + 1
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = int(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):

def calc_balance(balance, cost, num):
    now_balance = balance
    if ((now_balance - (cost * num)) >= 0):
        now_balance -= (cost * num)
    return now_balance


if __name__ == '__main__':

    a = {'coins': input(), 'value': 500}
    b = {'coins': input(), 'value': 100}
    c = {'coins': input(), 'value': 50}
    x = int(input())

    count = 0

    for i in range(0, int(c['coins']) + 1):
        balance_c = calc_balance(x, c['value'], i)
        if (balance_c == 0):
            count += 1
            break

        for j in range(0, int(b['coins']) + 1):
            balance_b = calc_balance(balance_c, b['value'], j)
            if (balance_b == 0):
                count += 1
                break

            for k in range(0, int(a['coins']) + 1):
                balance_a = calc_balance(balance_b, a['value'], k)
                if (balance_a == 0):
                    count += 1
                    break

    print(count)

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

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

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

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

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 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_a in range(a+1):
    for j_b in range(b+1):
        for k_c in range(c+1):
            if(i_a * 500 + j_b * 100 + k_c * 50 == x):
                count = count + 1
if a == b == c == 0:
    count = 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):
import numpy
import re
import math

def calc_pattern_num(a, b, c, sum_target):
	"""
	硬貨のパターンからsumになるパターンを算出
	:param a:
	:param b:
	:param c:
	:param sum:
	:return:
	"""
	count = 0
	for i in range(0, a+1):
		for j in range(0, b + 1):
			for k in range(0, c + 1):
				sum = 500 * i + 100 * j + 50 * k
				if sum == sum_target:
					count += 1
	return count

def main():
	"""
	テストコード実行
	:return:
	"""
	a = int(input())
	b = int(input())
	c = int(input())
	sum = int(input())
	print(calc_pattern_num(a, b, c, sum))

if __name__ == '__main__':
	main()

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
if ((A+B+C<1) or (A<0 or A>50) or (B<0 or B>50) or (C<0 or C>50) or (X<50 or X > 20000 or X%50!=0)):
    print("条件を満たしてください")
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            Y = i*500 + j*100 + k*50
            if (X==Y):
                count = 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):
A, B, C, X = int(input()),int(input()),int(input()),int(input())

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

Solution (Python):
l = [int(input()) for i in range(4)]
a = 0
for i in range(l[2]+1):
    for j in range(l[1]+1):
        for k in range(l[0]+1):
            b = 50 * i + 100 * j 
            b += 500 * k 
            if b == l[3] :
                a += 1
                 
print('{}'.format(a))

Solution (Python):

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

number_of_combination = 0


for k in range(0,A+1):
    number_of_a = k
    for j in range(0,B+1):
        number_of_b = j
        for i in range(0,C+1):
            number_of_c = i
            sum = 500*number_of_a + 100*number_of_b + 50*number_of_c
            if sum == X:
                number_of_combination += 1

print(number_of_combination)

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

i = 0
j = 0
k = 0
res = 0
cnt = 0

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

print(count)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]
ans = 0
for a in range(A + 1):
    if X < 500 * a:
        break
    for b in range(B + 1):
        remainder = X - 500 * a - 100 * b
        if remainder < 0:
            break
        if remainder // 50 > C:
            continue
        ans += 1
print(ans)

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

Solution (Python):
def num_2n(i):
    count = 0
    while(i % 2 == 0):
        i = i / 2
        count += 1
    return count


def main():
    num_a = int(input())
    num_b = int(input())
    num_c = int(input())
    num_x = int(input())
    count = 0
    for in_a in range(num_a + 1):
        for in_b in range(num_b + 1):
            for in_c in range(num_c + 1):
                if num_x == in_a * 500 + in_b * 100 + in_c * 50: count += 1 
    print(count)

    
    


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import product

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

ans = 0
for i, j, k in product(range(A + 1), range(B + 1), 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 d in range(A +1):
    for e in range(B+ 1):
        for f in range(C+1):
            if d* 500 + e* 100 + f*50 == X:
                count = count + 1
print(int(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 i * 500 + j * 100 + k * 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):
input_lines = 4
coin_list = []
for i in range(input_lines):
  s = int(input())
  coin_list.append(s)


def calc(coin_list, total = 0, count = 0):
    yen_500 = coin_list[0]
    yen_100 = coin_list[1]
    yen_50 = coin_list[2]
    total_yen = coin_list[3]

    for i in range(yen_500+1):
        for j in range(yen_100+1):
            for k in range(yen_50+1):
                if 500 * i + 100 * j + 50 * k == total_yen:
                    count += 1
    return count

calcurate = calc(coin_list)
print(calcurate)

Solution (Python):
input_lines = 4
coin_list = []
for i in range(input_lines):
  s = int(input())
  coin_list.append(s)


def calc(coin_list, total = 0, count = 0):
    yen_500 = coin_list[0]
    yen_100 = coin_list[1]
    yen_50 = coin_list[2]
    total_yen = coin_list[3]

    for i in range(yen_500+1):
        for j in range(yen_100+1):
            for k in range(yen_50+1):
                if 500 * i + 100 * j + 50 * k == total_yen:
                    count += 1
    return count

calcurate = calc(coin_list)
print(calcurate)

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


print(cnt)

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

price = [500, 100, 50]
count = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if price[0]*i + price[1]*j + price[2]*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):
            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())

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

print(patterns)

Solution (Python):
def sum_price(i, j, k):
    return i*500 + j*100 + k*50


if __name__ == '__main__':
    li = []
    for i in range(4):
        li.append(int(input()))

    goal_price = li[3]
    cnt = 0
    for i in range(li[0]+1):
        for j in range(li[1]+1):
            for k in range(li[2]+1):
                if sum_price(i, j, k) == goal_price:
                    cnt += 1

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

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

i=0
aam=int(x//10)
if aam > a:
    aam=a
for aa in range(aam+1):
    y=x-10*aa
    bbm=y//2

    if bbm > b:
        bbm=b
        
    for bb in range(int(bbm)+1):
    	if y-2*bb<=c:
        	i+=1
print(int(i))

Solution (Python):
fh_num = int(input())
oh_num = int(input())
fif_num = int(input())
sum = int(input())

i = 0
j = 0
t = 0
all = 0
count = 0

for i in range(fh_num + 1):
  for j in range(oh_num + 1):
    for t in range(fif_num + 1):
      all = 50 * t + 100 * j + 500 * i
      if all == sum:
        count += 1
      all = 0

print(int(count))

Solution (Python):
yen500 = int(input(''))
yen100 = int(input(''))
yen50 = int(input(''))
total = int(input(''))
count = 0
for x in range(yen500 + 1):
  for y in range(yen100 + 1):
    for z in range(yen50 + 1):
      if 500 * x + 100 * y + 50 * z == total:
        count += 1

print(count)

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

total = [500*a+100*b+50*c for a in range(num[0]+1) for b in range(num[1]+1) for c in range(num[2]+1)]
print(total.count(int(input())))

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

for na in range(a+1):
     for nb in range(b+1):
        for nc in range(c+1):
            if x == 500 * na + 100 * nb + 50 * nc: 
                variation += 1

print(variation)

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

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

Solution (Python):
five = int(input()) +1
one = int(input()) +1
fifty = int(input()) +1
target = int(input())
score = 0

for i in range(five):
    if(i*500 > target):
        break
    for j in range(one):
        if (i*500+j*100 > target):
            break
        for k in range(fifty):
            if(i*500+j*100+k*50 == target):
                score += 1
print(score)

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

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

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

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

Solution (Python):
A=int(input().strip())
B=int(input().strip())
C=int(input().strip())
X=int(input().strip())
ct=0
for a in range(A+1):
    for b in range(B+1):
        rest=X-(a*500+b*100)
        if rest>=0 and rest/50<=C:
            ct+=1
print(ct)

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


num = 0

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

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