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

print(output)

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

print(ans)

Solution (Python):
n500=int(input())
n100=int(input())
n50=int(input())
S=int(input())
a=0
for i in range(n500+1):
  for k in range(n100+1):
    for c in range(n50+1):
      s=500*i+100*k+50*c
      if s==S:
        a +=1
print(a)

Solution (Python):



A_num = int(input())
B_num = int(input())
C_num = int(input())
X_yen = int(input())
count = 0

for a in range(A_num+1):
    for b in range(B_num+1):
        for c in range(C_num+1):
            total = 500*a + 100*b + 50*c
            if total == X_yen:
                count += 1
print(count)

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

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

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

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

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

count = 0

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

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

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

Solution (Python):
A, B, C, X = map(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):
			value = 500 * a + 100 * b + 50 * c
			if X == value:
				count += 1
print(count)

Solution (Python):

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

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

print(counter)

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

count = 0
max_a = min(X // 500, A)
for i in range(max_a+1):
  x = X - 500 * i
  max_b = min(x // 100, B)
  for j in range(max_b+1):
    y = x - 100 * j
    c = y // 50
    if c <= C:
      count += 1
print(count)

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

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

print(cnt)

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

Solution (Python):
A, B, C, X = map(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 a * 500 + b * 100 + 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 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())

y = 0

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

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

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

print(y)

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

Solution (Python):
cnt500=int(input())
cnt100=int(input())
cnt50=int(input())
price=int(input())

cnt=0
for a in range(cnt500+1):
  if cnt500*a > price:
    break
  for b in range(cnt100+1):
    if cnt100*b > price:
      break
    for c in range(cnt50+1):
      if cnt50*c > price:
        break
      if a*500+b*100+c*50 == price:
        cnt+=1
print(cnt)

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

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

print(cnt)

Solution (Python):
a500 = int(input())
b100 = int(input())
c50 = int(input())
X = int(input())
ans = 0
goukei = 0
is_over = False
for i in range(a500+1):
  for j in range(b100+1):
    for k in range(c50+1):
      goukei = i * 500 + j * 100 + k * 50
      if goukei == X:
        ans += 1
        break
print(ans)

Solution (Python):
a500 = int(input())
b100 = int(input())
c50 = int(input())
X = int(input())
ans = 0
goukei = 0
is_over = False
for i in range(a500+1):
  for j in range(b100+1):
    for k in range(c50+1):
      goukei = i * 500 + j * 100 + k * 50
      if goukei == X:
        ans += 1
print(ans)

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

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 = 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())
cont = 0
total = 0
a = 500
b = 100
c = 50
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0,C+1):
            total = a*i + b*j + c*k
            if total == X:
                cont += 1
print(cont)

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

ans = 0

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

print(ans)

Solution (Python):
import sys
a, b, c, x = [int(sys.stdin.readline()) 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):
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 500 * a + 100 * b + 50 * c == X:
                counter += 1
print(counter)

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

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

for ia in range(a+1):
	for ib in range(b+1):
		for ic in range(c+1):
			if x == ia*500+ib*100+ic*50:
				ans += 1
print(ans)

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


result = 0
for aa in range(a+1):
  for bb in range(b+1):
    for cc in range(c+1):
      if x == aa*500 + bb * 100 + cc * 50:
        result = result + 1

print(result)

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

ans=0
a=math.floor(X/500)
for i in range(min(A,a)+1):
    X2=X-500*i
    b=math.floor(X2/100)
    for j in range(min(B,b)+1):
        X3=X2-100*j
        if X3%50==0:
            c=X3/50
            if c<=C:
                ans+=1
            else:
                continue
        else:
            continue
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
print(len([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]))

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

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

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

Solution (Python):
A, B, C, x = map(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
                break

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

print(count)

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

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

print ctr

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

print(count)

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

sums = []
sum = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            sums.append(500*i + 100*j + 50*k)

print(sums.count(x))

Solution (Python):
A, B, C, X = map(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 500 * a + 100 * b + 50 * c == X:
                count += 1

print(count)

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

for an in range(A+1):
    for bn in range(B+1):
        for cn in range(C+1):
            if 500*an+100*bn+50*cn==X:
                counter+=1

print(counter)

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

for rep1 in range(a + 1):
    for rep2 in range(b + 1):
        for rep3 in range(c + 1):
            if rep1 * 500 + rep2 * 100 + rep3 * 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(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):

input500=int(input())
input100=int(input())
input50=int(input())
inputSum=int(input())


sumWay=0
tempSum=0

if inputSum >= 500:
    
    for i in range(input500 + 1):
        tempSum=0
        tempSum+=(500 * i)
        
        
        if inputSum == tempSum:
            sumWay+=1
            break
        
        elif tempSum < inputSum :
            
            for m in range(input100 + 1):
                tempSum100=tempSum
                tempSum100=tempSum + (100 * m)
                if inputSum < tempSum100:
                    break
                elif tempSum100 == inputSum:
                    sumWay+=1
                    continue
                else:
                    
                    for n in range(input50 + 1):
                        tempSum50=tempSum100
                        tempSum50= tempSum100 + (50 * n)
                        
                        if inputSum == tempSum50:
                            sumWay+=1
                            continue
                        elif inputSum < tempSum50:
                            break
elif inputSum < 500 and inputSum >= 100:

    for m in range(input100 + 1):
        tempSum100= 100 * m
        if inputSum < tempSum100:
            break
        elif tempSum100 == inputSum:
            sumWay+=1
            continue
        else:
            
            for n in range(input50 + 1):
                tempSum50=tempSum100
                tempSum50= tempSum100 + (50 * n)
                
                if inputSum == tempSum50:
                    sumWay+=1
                    continue
                elif inputSum < tempSum50:
                    break
elif inputSum < 100:

    for n in range(input50 + 1):
        tempSum50= 50 * n
        
        if inputSum == tempSum50:
            sumWay+=1
            continue
        elif inputSum < tempSum50:
            break

print(sumWay)

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

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

Solution (Python):
a,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):
            s = 500 * i + 100 * j + 50 * k
            if s == x:
                count +=1
            
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
price = 0
c = 0
b = 0
a = 0

def sum_price(a, b, c):
    return a*500 + b*100 + c*50

while c <= C:
    if sum_price(a, b, c) == X:
        cnt += 1
        break
    while b <= B:
        if sum_price(a, b, c) == X:
            cnt += 1
            break
        while a <= A:
            if sum_price(a, b, c) == X:
                cnt += 1
                break
            a += 1
        a = 0
        b += 1
    b = 0
    c += 1

print(cnt)

Solution (Python):
import numpy as np
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
coin = np.array([500,100,50])
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if a + b + c == 0:
        continue
      else:
        if X == coin.dot(np.array([a,b,c])):
            count += 1
print(count)

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

Solution (Python):
a, b, c, x = eval("int(input())," * 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):
A, B, C, X = [int(input()) for _ in range(4)]


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

print(ans)

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

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

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

p = 0 

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

print(p)

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 s in range(C + 1):
            total_value = 500*i + 100*j + 50*s     
            if total_value == 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):


list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            count += list[3] == 500 * ii + 100 * jj + 50 * kk

print(count)

Solution (Python):


list = []
for _ in range(4):
    list += [int(input())]

count = 0
for ii in range(list[0] + 1):
    for jj in range(list[1] + 1):
        for kk in range(list[2] + 1):
            if list[3] == 500 * ii + 100 * jj + 50 * kk:
                count += 1

print(count)

Solution (Python):
fh = int(input())
h = int(input())
f = int(input())
p = int(input())

ans = 0
for i in range(fh + 1):
  for j in range(h + 1):
    for k in range(f + 1):
      if 500 * i + 100 * j + 50 * k == p:
        ans += 1
print(ans)

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

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

print(counter)

Solution (Python):

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

count = 0

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

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

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

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

count = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if (10*a+2*b+c == int(X/50)):
        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 i * 500 + j * 100 + k * 50 == X:
                cnt += 1
print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for i in range(A+1):
    for j in range(B+1):
        total = 500*i + 100*j
        if total == X:
            counter += 1
        for k in range(C):
            total += 50
            if total == X:
                counter += 1
            elif total > X:
                break
print(counter)

Solution (Python):

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

cnt = 0

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

print(cnt)

Solution (Python):


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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
     for j in range(b+1):
          for k in range(c+1):
              if 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
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:
        n += 1
print(n)

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

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

print(check(A, B, C, X))

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

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

print(ct)

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

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

aa = 0
while aa<=a:
  bb = 0
  while bb<=b:
    cc = 0
    while cc<=c:
      if aa * 500 + bb * 100 + cc * 50 == x:
        ans += 1
      cc += 1
    bb += 1
  aa += 1

print(ans)

Solution (Python):



import sys


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

ans = 0
for a in range(51):
  for b in range(51):
    if (X - a*500 - b*100) % 50 > 0 or a > A or b > B:
      continue
    else:
      c = (X - a*500 - b*100) // 50
      if c >= 0 and c <= C:
        ans += 1

print(ans)

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

res = 0

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

print(res)

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

Solution (Python):
coin_list = []
for i in range(3):
    s = int(input())
    coin_list.append(s)
target = int(input())
counter = 0

for a in range(coin_list[0]+1):
    for b in range(coin_list[1]+1):
        for c in range(coin_list[2]+1):
            total = 500*a + 100*b + 50*c
            if total == target:
                counter = counter + 1
            if total > target:
                break

print(counter)

Solution (Python):
coin_list = []
for i in range(3):
    s = int(input())
    coin_list.append(s)
target = int(input())
counter = 0

for a in range(coin_list[0]+1):
    for b in range(coin_list[1]+1):
        for c in range(coin_list[2]+1):
            total = 500*a + 100*b + 50*c
            if total == target:
                counter = 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):
      if 500*i+100*j+50*k == x:
        ans=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):
    lest = x - i*500 - j*100
    if lest >= 0 and lest % 50 == 0 and lest // 50 <= c:
      ans += 1
      
print(ans)

Solution (Python):


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


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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
list_A = list(range(A+1))
list_B = list(range(B+1))
list_C = list(range(C+1))
cnt = 0
for i in range(len(list_A)):
        for j in range(len(list_B)):
                for k in range(len(list_C)):
                        if X-(list_A[i]*500+list_B[j]*100+list_C[k]*50) == 0:
                                cnt += 1
                        else:
                                continue
print(cnt)

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

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

Solution (Python):

def coins():
    fivehund = int(input())
    onehund = int(input())
    fifty = int(input())
    target = int(input())
    result_count = 0

    for count500 in range(0,fivehund+1):
        for count100 in range(0,onehund+1):
            for count50 in range(0,fifty+1):
                 current = 500*count500 + 100*count100 + 50*count50
                 if target == current:
                     result_count += 1
    
    print(result_count)

if __name__ == '__main__':
    coins()

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

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

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

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

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

l = []
for i in range(0, A + 1):
    for j in range(0, B + 1):
        for k in range(0, C + 1):
            l.append([i, j, k])

ans = 0
for i in range(len(l)):
    if 500 * l[i][0] + 100 * l[i][1] + 50 * l[i][2] == 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 ((i*500) + (j*100) + (k*50)) == x:
                count += 1
            else:
                continue

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

count = 0
for Ai in range(A+1):
  for Bi in range(B+1):
    for Ci in range(C+1):
      price = Ai*500 + Bi*100 + Ci*50
      if price == X:
        count += 1
print(count)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            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())

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

print(answer)