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

count = 0
current_500 = 0
current_500_100 = 0

for num_500 in range(0, a + 1):
    current_500 = num_500 * 500
    if current_500 > x:
        break
    for num_100 in range(0, b + 1):
        current_500_100 = current_500 + num_100 * 100
        if current_500_100 > x:
            break
        for num_50 in range(0, c + 1):
            if current_500_100 + num_50 * 50 == x:
                count += 1
                break
print(count)

Solution (Python):
def calc_50(r, max_num_50):
    if r < 0:
        return 0
    elif r / 50 <= max_num_50:
        return 1
    else:
        return 0


def calc_100(r, max_num_100, max_num_50):
    count = 0
    for num_100 in range(0, max_num_100 + 1):
        count += calc_50(r - 100 * num_100, max_num_50)
    return count


def calc_500(r, max_num_500, max_num_100, max_num_50):
    count = 0
    for num_500 in range(0, max_num_500 + 1):
        count += calc_100(r - 500 * num_500, max_num_100, max_num_50)
    return count


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

print(calc_500(x, a, b, c))

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

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

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

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

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

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

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

print(ans)

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

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

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

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

Solution (Python):
import sys
from collections import defaultdict, deque
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline





L = [int(input()) for _ in range(4)]



ans = 0
for i in range(L[0] + 1):
    for j in range(L[1] + 1):
        for k in range(L[2] + 1):
            if 500 * i + 100 * j + 50 * k == L[3]:
                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):
    a = i * 500
    for j in range(B+1):
        b = j * 100
        for k in range(C+1):
            c = k * 50
            if a + b + c == X:
                ans += 1

print(ans)

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

M=[]
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            V=500*i+100*j+k*50
            M.append(V)
print(M.count(X))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
n = 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 == n:
                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,b,c,x=[int(input()) for _ 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,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 = 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,open(0))
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())+1
b = int(input())+1
c = int(input())+1
x = int(input())

counter = 0

for _a in range(a):
    for _b in range(b):
        for _c in range(c):
            ans = 500*_a + 100*_b + 50*_c
            if ans == x:
                counter += 1

print(counter)

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

counter = 0

for _a in range(a):
    for _b in range(b):
        for _c in range(c):
            ans = 500*_a + 100*_b + 50*_c
            if ans == x:
                counter += 1

print(counter)

Solution (Python):
a, b, c, x = map(int, open(0).read().split())

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

Solution (Python):

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

ans = 0
for i in range(A+1):
	for j in range(B+1):
		for k in range(C+1):
			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())

I = []
J = []
K = []
for i in range(A+1):
  if 500*i <= X:
    I.append(i)
for i in I:
  for j in range(B+1):
    if 100*j <= X-500*i:
      J.append([i,j])
for [i,j] in J:
  for k in range(C+1):
    if 50*k == X-500*i-100*j:
      K.append([i,j,k])

print(len(K))

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

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

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

ans = 0

for i in range(a+1):
    fhy = i * 500
    for j in range(b+1):
        ohy = j * 100
        for k in range(c+1):
            fty = k * 50
            if fhy + ohy + fty == 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):
        z = x-(500*i+100*j)
        if(z < 0):
            break
        if(z/50 <= c):
            cnt += 1

print(cnt)

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

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

print(cnt)

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

ans = 0

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

Solution (Python):
def calc(a, b, c, x):
    r = 0
    for aa in range(a+1):
        for bb in range(b+1):
            for cc in range(c+1):
                if aa * 500 + bb * 100 + cc*50 == x:
                    r += 1
    return r


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

r = calc(a, b, c, x)
print(r)

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
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
a = int(ns())
b = int(ns())
c = int(ns())
x = int(ns())

count = 0
for ai in range(a+1):
  if 500 * ai > x:
    break
  for bi in range(b+1):
    for ci in range(c+1):
      if 500 * ai + 100 * bi + 50 * ci == x:
        count += 1

print(count)

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

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

print(ret)

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



count=0

P=X
for i in range(A+1):
    X=P
    X-=500*i
    if X==0:
        count+=1
    elif X<0:
        pass
    else:
        Q=X
        for j in range(B+1):
            X=Q
            X-=100*j
            if X==0:
                count+=1
            elif X<0:
                pass

            else:
                R=X
                for k in range(C):
                    X=R
                    X-=50*(k+1)
                    if X==0:
                        count+=1
                    else:
                        pass

print(count)

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

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

print(count)

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

Solution (Python):
import numpy as np
import sys
a = int(input())
b = int(input())
c = int(input())
x = int(input())
value = [i*500 + j*100 + k*50 for i in range(a+1) for j in range(b+1) for k in range(c+1)]
print(value.count(x))

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

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

print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
a = range(A+1)
b = range(B+1)
c = range(C+1)
ans = 0
for i in a:
  for j in b:
    for k in c:
      if 10*i + 2*j + k == X/50:
      	ans = ans+1
print(ans)

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


count = 0
for x in range(a+1):
	for y in range(b+1):
		for z in range(c+1):
			count += 1 if( X == (500 * x + 100 * y + 50 * z)) else +0




print(count)

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

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

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

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

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

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
num=0
for i in range(a+1):
	x_i=x-500*i
	if x_i<0:
		break
	for j in range(b+1):
		
		x_j=x_i-100*j
		if x_j<0:
			break
		if x_j/50<=c:
			num+=1
			
print(num)

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

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

cnt = 0

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

print(cnt)

Solution (Python):


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

ans = 0

n_500 = min(x // 500, a)
for i in range(n_500 + 1):
    remainder_500 = x - 500 * i    
    n_100 = min(remainder_500 // 100, b)
    for j in range(n_100 + 1):
        remainder_100 = remainder_500 - 100 * j
        
        if remainder_100 // 50 <= c:
            
            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):
        c = X//50-10*a-2*b
        if 0 <= c and c <= C:
            ans += 1

print(ans)

Solution (Python):
def coins():
    import itertools

    A = [i for i in range(int(input())+1)]
    B = [i for i in range(int(input())+1)]
    C = [i for i in range(int(input())+1)]
    X = int(input())

    p = list(itertools.product(A,B,C))
    count = 0
    for i in p:
        sum = 500*i[0] + 100*i[1] + 50*i[2]
        if sum == X:
            count+=1

    print(count)

if __name__ == "__main__":
    coins()

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

Solution (Python):

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

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

print(ans)

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

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

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

ans = 0
for n_500yen in range(int(min(X/500, A)+1)):  
    for n_100yen in range(int(min(X/100, B)+1)):  
        for n_50yen in range(int(min(X/50, C)+1)):  
            if n_500yen*500+n_100yen*100+n_50yen*50 == X:
                ans += 1

print(ans)

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

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

Solution (Python):




def main():

    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)

if __name__ == "__main__":
    main()

Solution (Python):

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

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

print(ptn)

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

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

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

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


for i in range(A + 1):
    for j in range(B + 1):
        temp = X - (500 * i + 100 * j)
        if temp // 50 > C or temp < 0:
            continue
        else:
            ans += 1

print(ans)

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


for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            ans.append(500 * i + 100 * j + 50 * k)

print(ans.count(X))

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):
            am = 500 * i + 100 * j + 50 * k
            if am == X:
                ans += 1
                break
            else:
                continue

print(ans)

Solution (Python):


a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
strings = 'k:'

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))
print(sum([1 for q in range(a+1) for w in range(b+1) for e in range(c+1) if 500*q+100*w+50*e == x]))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
for s in range(1 + min(a, x//500)):
	for t in range(1 + min(b, (x-500*s)//100)):
		money = 500*s + 100*t
		amari = x - money
		if amari % 50 == 0 and amari <= 50 * c:
			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 +=1

print(ans)

Solution (Python):

A,B,C,X=map(int,open(0).read().split())
c = 0
for k in range(A+1):
    Y = X - 500*k
    for l in range(B+1):
        Z = Y - 100*l
        for m in range(C+1):
            U = Z - 50*m
            if U == 0:
                c += 1
print(c)

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

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

print(count)

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

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

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

for i in range(min(x//500 + 1,a + 1)):
    for j in range(min((x-i*500)//100 + 1,b + 1)):
        if (x-i*500-j*100)%50==0 and (x-i*500-j*100)//50 <= c:
            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):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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

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

count = 0
for i in range(A+1):
    for 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())

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

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

Solution (Python):
import sys
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

a = ni()
b = ni()
c = ni()
x = ni()
ans = 0
for ai in range(a+1):
        for bi in range(b+1):
                if (x - 500 * ai - 100 * bi) % 50 == 0 \
                        and (x - 500 * ai - 100 * bi) // 50 <= c \
                                and (x - 500 * ai - 100 * bi) // 50 >= 0:
                        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())
res=0
for  i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500*i + 100*j + 50*k == X:
                res += 1
print(res)

Solution (Python):



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


ans = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 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())

a = 0
b = 0
c = 0
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
        c=0
    b=0

if 0 == X :
    n+=1

print(n)

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

ways = 0

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

print(ways)

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
print(sum([ _a * 500 + _b * 100 + _c * 50 == x for _a in range(a+1) for _b in range(b+1) for _c in range(c+1)]))

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

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

count = 0
if x % 50 != 0:
    print(0)
else:
    for c in range(C+1):
        for b in range(B+1):
            for a in range(A+1):
                if c*50 + b*100 + a*500 == 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 i * 500 + j * 100 + k * 50 == 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 x == 500*i + 100*j + 50*k:
                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=["","",""]
for i in range(3):
    a[i]=int(input())
x=int(input())
cnt=0
for i in range(a[0]+1):
    for j in range(a[1]+1):
        for k in range(a[2]+1):
            ans = x-500*i - 100*j - 50*k
            if ans==0:
                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):
            Y = 500*a + 100*b + 50*c
            if Y == X:
                ans += 1
print(ans)

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

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

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

print(count)

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

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

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)