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

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

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

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

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

print([500*i+100*j+50*k for k in range(c+1) for j in range(b+1) for i in range(a+1)].count(x))

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

Solution (Python):
import math
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 = (x-500*i-100*j)/50
        if tmp <= c and tmp >= 0 and tmp - math.floor(tmp) == 0 :
            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 X == 500 * i + 100 * j + 50 * k:
                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):
            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())
count = 0
for i in range(a+1):
  for j in range(b+1):
    num = x - (500*i+100*j)
    if int(num / 50) <= c and 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 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=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    if i*500>x:
        break
    for j in range(b+1):
        if i*500+j*100>x:
            break
        if (x-(i*500+j*100))%50==0 and (x-(i*500+j*100))//50<=c:
            ans+=1
print(ans)

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

for coin500 in range(a+1):
    for coin100 in range(b+1):
        for coin50 in range(c+1):
            if coin500 * 500 + coin100 * 100 + coin50 * 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(0, a+1):
  for j in range(0, b+1):
    for k in range(0, c+1):
      total = 500*i + 100*j + 50*k
      if total == x:
        cnt = cnt + 1
print(cnt)

Solution (Python):
input_num = [int(input()) for i in range(4)]

coin_list = input_num[0:3]
result_yen = input_num[3]

count = 0

for yen_500 in range(coin_list[0]+1):
    for yen_100 in range(coin_list[1]+1):
        for yen_50 in range(coin_list[2]+1):
            if result_yen == yen_500*500 + yen_100*100 + yen_50 *50:
                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=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==500*i+100*j+50*k:
                ans+=1
print(ans)

Solution (Python):










import numpy as np
import math
import copy

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


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

print(total)

Solution (Python):



from sys import stdin

A = int(stdin.readline().rstrip())
B = int(stdin.readline().rstrip())
C = int(stdin.readline().rstrip())
X = int(stdin.readline().rstrip())

total = 0
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 = int(input())
b = int(input())
c = int(input())
x = int(input())
inc =0

for i in range(a+1):
    for ii in range(b+1):
        for iii in range(c+1):
            if (i*500 + ii*100 + iii*50) == x:
                inc +=1

print(inc)

Solution (Python):

import sys


def solve(A: int, B: int, C: int, X: int):
    ret = 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:
                    ret += 1
    print(ret)
    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):
import itertools
A = int(input())
B = int(input())
C = int(input())
X = int(input())
AL = [500*i for i in range(A+1)]
BL = [100*i for i in range(B+1)]
CL = [50*i for i in range(C+1)]
num = 0

for comb in itertools.product(AL,BL,CL):
  x,y,z = comb
  if x + y + z == X:
    num += 1
print(num)

Solution (Python):



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




if __name__ == '__main__':
    main()

Solution (Python):
yen_500 = int(input())
yen_100 = int(input())
yen_50 = int(input())
yen_x = int(input())
done_cnt = 0
for i in range(yen_500 + 1):
    for j in range(yen_100 + 1):
        for k in range(yen_50 + 1):
            if yen_x == 500 * (i) + 100 * (j) + 50 * (k):
                done_cnt += 1 
print(done_cnt)

Solution (Python):
def culc_sum(i_a,i_b,i_c):
    return (500 * i_a + 100 * i_b + 50 * i_c)


a_n = int(input())
b_n = int(input())
c_n = int(input())

X = int(input())

result = 0

for i_a in range(a_n + 1):
  if (500 * i_a) > X:
    break
  for i_b in range(b_n + 1):
    if (500 * i_a + 100 * i_b) > X:
      break
    for i_c in range(c_n + 1):
      
      if culc_sum(i_a,i_b,i_c) == X:
        result = result + 1
        break

print(result)

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

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

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

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

n=0

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

print(n)

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

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

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):
c_500 = int(input())
c_100 = int(input())
c_050 = int(input())
x = int(input())

ans = 0
for u_500 in range(0, c_500+1):
    for u_100 in range(0, c_100+1):
        for u_050 in range(0, c_050+1):
            if (u_500 * 500 + u_100 * 100 + u_050 * 50) == x:
                ans += 1

print(ans)

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


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

print(count)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
l=[]
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      l.append([i,j,k])
c=0
for item in l:
  v=item[0]*500+item[1]*100+item[2]*50
  if v==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 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
countlist=[]

for e in range(0,a+1):
    if e*500 <= x:
        y=x-e*500
        for f in range(0,b+1):
            if f*100 <= y:
                z=y-100*f
                for g in range(0,c+1):
                    if g*50 == z :                                            
                        count = count +1

print(count)

Solution (Python):
a,b,c,d = list(int(input()) for i in range(4))
ans = 0
for i in range(a + 1):
    for o in range(b + 1):
        for p in range(c + 1):
            if 500 * i + 100 * o + 50 * p == d:
                ans += 1
print(ans)

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

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

cnt = 0
for i in reversed(range(A + 1)):
	for j in range(B + 1):
		sum = X - (500 * i) - (100 * j)
		if sum < 0:
			break
		if sum // 50 <= C:
			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
print(count)

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):
from sys import stdin
A=int(stdin.readline().rstrip())
B=int(stdin.readline().rstrip())
C=int(stdin.readline().rstrip())
X=int(stdin.readline().rstrip())
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())

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 v in range(C+1):
            if 500*i + 100*j + 50*v == 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 i*500 + j*100 + k*50 == x:
                count = count + 1
print(count)

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

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==500*i+100*j+50*k:
				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):
num500 = int(input())
num100 = int(input())
num50 = int(input())
numSum = int(input())

patternCounter = 0

for count500 in range(num500 +1):
    if numSum < count500 * 500:
        break
    for count100 in range(num100 + 1 ):
        if numSum < ((count500 * 500) + (count100 * 100)):
            break
        for count50 in range(num50 + 1):
            if numSum < ((count500 * 500) + (count100 * 100) + (count50 * 50)):
                break
            elif numSum == ((count500 * 500) + (count100 * 100) + (count50 * 50)):
                patternCounter +=1

print(patternCounter)

Solution (Python):
A, B, C, x = [int(input()) for i in range(4)]
result = 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:
        result += 1
print(result)

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

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=[int(input()) for i 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())
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 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:
				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):
    current = x - 500*i
    if current < 0:
        break
    elif current == 0:
        ans += 1
        break
    for j in range(b+1):
        current2 = current - 100*j
        if current2 < 0:
            break
        elif current2 == 0:
            ans += 1
            break
        for k in range(c+1):
            current3 = current2 - 50*k
            if current3 < 0:
                break
            elif current3 == 0:
                ans += 1
                break

print(ans)

Solution (Python):
yen500 = int(input())
yen100 = int(input())
yen50 = int(input())
sum = int(input())
count = 0

for i in range(yen500 + 1):
  for j in range(yen100 + 1):
    for k in range(yen50 + 1):
      if (500 * i + 100 * j + 50 * k) == sum:
        count += 1
        
print(count)

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

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

Solution (Python):
import itertools

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

    A_list = list(map(lambda x: x * 500, range(A + 1)))
    B_list = list(map(lambda x: x * 100, range(B + 1)))
    C_list = list(map(lambda x: x * 50, range(C + 1)))

    all_list = list(itertools.product(A_list, B_list, C_list))
    sum_list = list(map(lambda t: sum(t), all_list))
    print(sum_list.count(X))

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

    counter = 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 total == X:
                    counter += 1

    print(counter)

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,b,c,x=[int(input()) for i in range(4)]
x//=50
p=min(a,x//10)
ans=0
for i in range(p+1):
    y=x-10*i
    q=min(b,y//2)
    for j in range(q+1):
        z=y-2*j
        if c>=z:ans+=1
print(ans)

Solution (Python):
a,b,c,x=[int(input()) for i 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())

a, b, c = [500, 100, 50]
count = 0

for _A in range(A+1):
  if (_A*a > X):
    break
  for _B in range(B+1):
    d = X - _A*a - _B*b
    if (d/c <= C and d>=0):
      count = count + 1

print("{}".format(count))

Solution (Python):







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

print(sum)

Solution (Python):







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

for i in range(0,A+1):
    for j in range(0,B+1):
        
        if C == 0:
            if i*500 + j*100 == X:
                sum+=1
                break
        
        else:
            k = ( X - i*500 - j*100 ) / 50
            
            if k < 0:
                break
            if k<=C:
                sum+=1
        
        

print(sum)

Solution (Python):
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
X = int(input())

answer = 0

for i in range(coin500 + 1):
    for j in range(coin100 + 1):
        for k in range(coin50 + 1):
            if 500 * i + 100 * j + 50 * k == X:
                answer += 1

print(answer)

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

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

Solution (Python):
a, b, c, x = [int(input()) for i in range(4)]
cnt = 0
for i in range(a+1):
    for j in range(b+1):
        y = i * 500 + j * 100
        if x-y >= 0 and (x-y) % 50 == 0 and (x-y)//50 <= c:
            cnt += 1
            

print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
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):
        if 0 <= x - (500*i) - (100*j) <= (50*c):
            ans += 1
print(ans)

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

counter = 0

N_maxA = min( int(X // 500), A )

for i in range(N_maxA + 1):
	Res = X - (i * 500)
	N_maxB = min( int(Res // 100) , B )
	
	for j in range(N_maxB + 1):
		Res1 = Res - j*100
		if int(Res1 // 50) <= C:
			
			counter += 1

print(counter)

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

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

print(cnt)

Solution (Python):
gohyaku = int(input())
hyaku = int(input())
gozyuu = int(input())
x = int(input())

count = 0
for i in range(gohyaku+1):
    for j in range(hyaku+1):
        for k in range(gozyuu+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 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())
cnt = 0
for i in range(b + 1):
    for j in range(c + 1):
        a500 = (x//50 - 2 * i - j) /10
        if 0 <= a500 <=a and a500.is_integer():
            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+50*k==x:
                                ans+=1
print(ans)

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

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

Solution (Python):
A,B,C,X = [int(input()) for i in range(4)]
n,a=0,0
while a<A+1:
  b=0
  while b<B+1:
    x=a*500+b*100
    b+=1
    if X<x:continue
    if (X-x)<=C*50:n+=1
  a+=1
print(n)

Solution (Python):
a,b,c,x=[int(input()) for i 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()) 


i = 0
ans = 0


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


print(ans)

Solution (Python):
import sys
input = sys.stdin.readline

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 0 <= (X - 500*i - 100*j) // 50 <= C:
      ans += 1
print(ans)

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

cnt = 0
for i in range(min(X // 500, A) + 1):
  for j in range(min((X - 500 * i) // 100, B) + 1):
    if (X - 500 * i - 100 * j ) // 50 <= C:
      cnt += 1
print(cnt)

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

print(ans)

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

n=0
for a in range(A+1):
    X1=X-500*a 
    for b in range(B+1):
        X2=X1-100*b
        for c in range(C+1):
            X3=X2-50*c
            if X3==0:
                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 (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())

bb = b
cc = c

cnt = 0
 
while a > -1:
    b = bb
    while b > -1:
        c = cc
        while c > -1:
            if (500 * a + 100 * b + 50 * c) == x:
                cnt += 1
            c -= 1
        b -= 1
    a -= 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())
x=X//50
r=[]
for i in range(A+1):
    for k in range(B+1):
        for h in range(C+1):
            if i*500+k*100+h*50==X:
                r.append([i,k,h])
print(len(r))

Solution (Python):
a,b,c,X = [int(input()) for i in range(4)]
print([500*x+100*y+50*z for x in range(a+1) for y in range(b+1) for z in range(c+1)].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 i*500+j*100+k*50==x:
                cnt+=1
print(cnt)

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

res = 0
for i in range(a+1):
  if i * 500 > d:
    break
  for ii in range(b+1):
    if i * 500 + ii * 100 <= d:
      if (d - (i * 500 + ii * 100)) // 50 <= c:
        res+=1

print(res)

Solution (Python):
data=[0]*4
pt=[]
for i in range(4):
  data[i]=int(input())

cnt = 0
for i in range(data[2]+1):
    res = data[3]
    for j in range(data[1]+1):
        for k in range(data[0]+1):
            res=50*i+100*j+500*k
            if res==data[3]:
                cnt+=1
                pt.append([i,j,k])
                continue
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 500 * a + 100 * b + 50 * c == X:
                ans += 1
print(ans)

Solution (Python):
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]

cnt = 0
a,b,c,x=ipt(4,1)
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 = map(int, [input() for i in range(4)])
count = 0

for a_num in range(a+1):
    for b_num in range(b+1):
        for c_num in range(c+1):
            if a_num * 500 + b_num * 100 + c_num * 50 == x:
                count += 1
print(count)

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

for A_num in range(A+1):
    for B_num in range(B+1):
        for C_num in range(C+1):
            if A_num * 500 + B_num * 100 + C_num * 50 == X:
                count += 1
print(count)

Solution (Python):
from sys import stdin


def main():
    A, B, C, X = [int(stdin.readline().rstrip()) for _ in range(4)]
    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)


if __name__ == "__main__":
    main()

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

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

print(num_x)

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,B,C,X = [int(input()) for x in range(4)]
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,b,c,x=[int(input()) for _ in range(4)]
cnt=0
for i in range(a+1):
    total=0
    for j in range(b+1):
        k=(x-(500*i+100*j))//50
        if k<=c and k>=0 : 
            total=500*i+100*j+50*k
            if total==x:cnt+=1
print(cnt)

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

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