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):
from collections import deque

a, b, c, x = [int(input()) for i in range(4)]
d = min(x // 500, a)
e = min((x - d * 500) // 100, b)
f = min((x - d * 500 - e * 100) // 50, c)
y = deque([[d, e, f]])
if d * 500 + e * 100 + f * 50 < x:
    print(0)
else:
    g = 1
    y.append([d, e, f])
    s, t, u = y.popleft()
    while s > 0:
        s -= 1
        t += 5
        y.append([s, t, u])
        if t <= b:
            g += 1
    while y:
        s, t, u = y.popleft()
        while t > 0:
            t -= 1
            u += 2
            if u > c:
                break
            if t <= b:
                g += 1
    print(g)

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

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

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):
def solve():
    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
    return print(count)

if __name__ == '__main__':
    solve()

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

for p in range(a+1):
    for q in range(b+1):
        for r in range (c+1):
            if (500*p) + (100*q) + (50*r) == total:
                count = count + 1;


print(count);

Solution (Python):
x = [int(input()) for i in range(4)]
cnt = 0
for i in range(x[0] + 1):
    for j in range(x[1] + 1):
        for k in range(x[2] + 1):
            if i*500+j*100+k*50 == x[3]:
                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, min(x // 500 + 1, a + 1)):
    
    for j in range(0, min((x - 500 * i) // 100 + 1, b + 1)):
        
        if (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())

l = []
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            l.append([i, j, k])
count = 0
for i in range(len(l)):
    sum = l[i][0] * 500 + l[i][1] * 100 + l[i][2] * 50
    if sum == x:
        count += 1
print(count)

Solution (Python):
a, b, c, money = [int(input()) for i 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 == money:
        counter += 1
        
print(counter)

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

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

print(result)

Solution (Python):
a = list(map(int,open(0).read().split()))
res = 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]: res+=1
print(res)

Solution (Python):

def ABC_87_B():
    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):
                s=i*500+j*100+k*50
                if s == X:
                    count+=1

    print(count)


if __name__ == '__main__':

    ABC_87_B()

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

Solution (Python):
input_list = [int(input()) for i in range(4)]
number_of_coins = [input_list[0],input_list[1],input_list[2]]

price = input_list[3]

pattern = 0 

for i in range(number_of_coins[0]+1):
  for j in range(number_of_coins[1]+1):
    for k in range(number_of_coins[2]+1):
      if(500 * i + 100 * j + 50 * k == price):
          pattern += 1

print(pattern)

Solution (Python):
FHY = int(input())
OHY = int(input())
FTY = int(input())
X = int(input())
a = X // 500
b = X // 100
c = X // 50
l1 = min(FHY,a)
l2 = min(OHY,b)
l3 = min(FTY,c)

count = 0

for i in range(l1+1):
    for j in range(l2+1):
        for k in range(l3+1):
            temp = (i * 500) + (j * 100) + (k *50)
            if temp == 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):
            price = 500*i + 100*j + 50*k
            if price == 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())

count = 0
s = 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("{}".format(count))

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

ans = 0
for a in range(A + 1):
    sum = 500 * a
    if sum == X:
        ans += 1
        break
    elif sum > X:
        break
    else:
        d = X - sum
        for b in range(B + 1):
            for c in range(C + 1):
                t = 100 * b + 50 * c
                if t == d:
                    ans += 1
                    break
                elif t > d:
                    break
                else:
                    continue

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

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

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int, X: int):
    ans = 0
    for yen500 in range(0, A + 1):
        for yen100 in range(0, B + 1):
            for yen50 in range(0, C + 1):
                if yen500 * 500 + yen100 * 100 + yen50 * 50 == X:
                    ans += 1

    print(ans)
    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):
from itertools import product
A, B, C, X = [int(input()) for _ in range(4)]
ans = 0
for a, b, c in product(range(A + 1), range(B + 1), range(C + 1)):
    if 500 * a + 100 * b + 50 * c == X:
        ans += 1

print(ans)

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

Solution (Python):


from itertools import combinations_with_replacement as comb_with
A = int(input())





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

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

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

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

Solution (Python):

import sys
input = sys.stdin.readline
A500 = int(input())
B100 = int(input())
C50 = int(input())
X = int(input())

ans =0
num_500 =0

if 1 <= X //500 <=A500: 
    num_500 =X//500
elif X //500 <1:
    num_500 =0
else:
    num_500 =A500


num_100_list =[0]
num_100 =0
if num_500 !=0:
    for i in range(num_500+1):
        if 1 <= (X -500*i) /100 <=B100:
            num_100_list.append( (X -500*i) //100 )
        elif (X -500*i) /100 <1:
            num_100_list.append(0)
        else:
            num_100_list.append(B100)
else:
    if 1 <= X //100 <=B100: 
        num_100 =X//100
    elif X //100 <1:
        num_100 =0
    else:
        num_100 =B100
num_100 =max(max(num_100_list),num_100)

num_50 =0

for i in range(num_500 +1):
    for j in range(num_100 +1):
        if 0 <=(X -500*i -100 *j) /50 <=C50:
            
            ans +=1

print(ans)

Solution (Python):
from sys import stdin
def I(): return int(stdin.readline().rstrip())
    
coin = [I() for _ in range(3)]
x = I()
ans = 0
for i in range(coin[0]+1):
    sum = 500*i
    if sum<=x:
        for j in range(coin[1]+1):
            tmp = sum + 100*j
            if tmp<=x:
                for k in range(coin[2]+1):
                    if tmp+50*k==x:
                        ans += 1
                        break
                    elif x<tmp+50*k:
                        break
            else:
                break
    else:
        break

print(ans)

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
m=int(input())//50
ans=0
for x in range(1+min(a,m//10)):
  n=m-10*x
  for y in range(1+n//2):
    z=n-2*y
    if y<=b and z<=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(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:
				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):
            x = 500*a + 100*b + 50*c
            if X == x:
                ans += 1
            else:
                pass

print(ans)

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

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

Solution (Python):



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

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

Solution (Python):
def main():
    n = 4
    a = [int(input()) for i in range(n)]
    A = a[0]
    B = a[1]
    C = a[2]
    X = a[3]
    result = 0
    for i in range(A+1):
        for j in range(B+1):
            for k in range(C+1):
                value = 500 * i + 100 * j + 50 * k
                if value == X:
                    result += 1
    print(result)
if __name__ == '__main__':
    main()

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

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a, b, c, x = [ii() for _ in range(4)]
    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)


if __name__ == "__main__":
    main()

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

num = 0
total = 0

for i in range(a+1):
    for m in range(b+1):
        for p in range(c+1):
            total = 500*i + 100*m + 50*p
            if(X == total):
                num += 1

print(num)

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
            else:
                pass
print(count)

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

def multiple(l,m,n):
    ans = 500*l + 100*m + 50*n
    return ans
o = 0
p = 0
q = 0

while o <= a:
    while p <= b:
        while q <= c:
            ans_x = multiple(o,p,q)
            if x == ans_x:
                count += 1
            q += 1
        q = 0
        p += 1
    q = 0
    p = 0
    o += 1

print(count)

Solution (Python):



l = int(input())
m = int(input())
n = int(input())
x = int(input())

count = 0
for i in range(l + 1):
    p = 500 * i
    for j in range(m + 1):
        q = 100 * j
        for k in range(n + 1):
            r = 50 * k
            if p + q + r == 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())
total = 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:
        total = total + 1
print(total)

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

if __name__ == "__main__":
    main()

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
from fractions import gcd
import math
from math import ceil,floor
import collections








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



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

print(ans)

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

count=0
a_max=min(x//500,a) 
for i in range(a_max+1):
  
  b_max=min((x-500*i)//100,b) 
  
  for j in range(b_max+1):
    
    if (x-500*i-100*j)//50<=c:
      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 x == i*500 + j*100 + k*50:
                count += 1
print(count)

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

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())
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
            else:
                pass

print(count)

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

print(ans)

Solution (Python):
A, B, C, X = map(int, open(0))
ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        if 500 * i + 100 * j > X:
            break
        rem = X - 500 * i - 100 * j
        if rem // 50 <= C:
            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):
        if 500 * i + 100 * j > X:
            break
        rem = X - 500 * i - 100 * j
        if rem // 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(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            y = 500 * i + 100 * j + 50 * k
            if y == x:
                cnt += 1
                
print(cnt)

Solution (Python):

a, b, c = int(input())+1, int(input())+1, int(input())+1 
X = int(input())


import itertools 
coins_a, coins_b, coins_c = [], [], []
for i in range(a):
  coins_a.append(500*i)
for i in range(b):
  coins_b.append(100*i)
for i in range(c):
  coins_c.append(50*i)
coins = list(itertools.product(coins_a, coins_b, coins_c))


ttl = list(map(sum, coins))
result = []
for n in ttl:
  if n == X: result.append(1)
  else: result.append(0)

print(sum(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 l in range(c + 1):
            total = i * 500 + j * 100 + 50 * l
            if(total == 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())

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

print(solve())

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

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

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

Solution (Python):
n500 = int(input())
n100 = int(input())
n50 = int(input())
p = int(input())
ans = 0

for i in range(n500+1):
    for j in range(n100+1):
        for k in range(n50+1):
            temp = i*500+j*100+k*50 
            if temp == p:
                ans+=1

print(ans)

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

answer = 0

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

Solution (Python):

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

i=0

ans=0
while i <=A:
    X_aftera=X-500*i
    if X_aftera<0:
        break
    j=0
    while j<=B:
        X_afterb=X_aftera-100*j
        if X_afterb<0:
            break
        if X_afterb//50<=C:
            ans +=1
        j+=1
    i+=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 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())

m = X / 50
count = 0
for a in range(A+1):
    z = m - 10*a
    if z < 0:
        break
    else:
        for b in range(B+1):
            y = z - 2*b
            if y >= 0 and C >= y :
                count += 1
            elif y < 0:
                break
print(count)

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

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

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
l = [500, 100, 50]
ans = 0
for i in range(a+1):
    for j in range(b+1):
        s = 500*i + 100*j
        if (x-s)%50==0 and (x-s) >= 0 and (x-s)<= 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(A+1):
  for j in range(B+1):
    s=i*500+j*100
    if (X-s)%50==0 and (X-s)/50<=C and (X-s)/50>=0:
      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 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())
cnt = 0
for a in range(0,A+1):
    for b in range(0,B+1):
        for c in range(0,C+1):
            if a * 500 + b * 100 + c * 50 ==X:
                cnt+=1
print(cnt)

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

count = 0

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

Solution (Python):
a500 = int(input())
b100 = int(input())
c50 = int(input())
_x = int(input())
answer = 0
for c in range(c50+1):
    for b in range( b100+1):
        for a in range(a500+1):
            
            if a*500 + b*100 + c*50 == _x:
                answer += 1
print (answer)

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

ans=0

for i in range(a+1):
    for j in range(b+1):
        for 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())
x=int(input())
z=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:
				z+=1
print(z)

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

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

print(count)

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

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

print(pair_num)

Solution (Python):
a=[]
for i in range(3):
    a.append(int(input()))
x=int(input())
ans=0

for i in range(a[0]+1):
    for j in range(a[1]+1):
        for k in range(a[2]+1):
            if i*500+j*100+k*50==x:
                ans+=1
print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**7)

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

xx = x/50
count=0

for na in range(a+1):
    for nb in range(b+1):
        for nc in range(c+1):
            if na*10 + nb*2 + nc == xx:
                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())

count = 0

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

print(count)

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

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())
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 _ 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, B, C, X = [int(input()) for i in range(4)]
print(sum(500 * a + 100 * b + 50 * c == X for a in range(A+1) for b in range(B + 1) for c in range(C + 1)))

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(sum(500*a+100*b+50*c == X for a in range(A+1)
          for b in range(B+1) for c in range(C+1)))

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

for i in range(0,a+1):
  for j in range(0,b+1):
    for k in range(0,c+1):
      r.append(500*i + 100*j + 50*k)

print(r.count(x))

Solution (Python):
a_l = list(range(0,int(input())+1))
b_l = list(range(0,int(input())+1))
c_l = list(range(0,int(input())+1))
X = int(input())

count = 0
for a in a_l :
    for b in b_l :
        for c in c_l :
            N = 500 * a + 100 * b + 50 * c
            if N == X :
                count = count + 1

print(count)

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

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

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