Problem:
 Score : 200 points    Problem Statement You have A  500 -yen coins, B  100 -yen coins and C  50 -yen coins (yen is the currency of Japan).
In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.      Constraints  0 \leq A, B, C \leq 50  A + B + C \geq 1  50 \leq X \leq 20  000  A , B and C are integers.  X is a multiple of 50 .         Input Input is given from Standard Input in the following format:  A  B  C  X       Output Print the number of ways to select coins.        Sample Input 1 2
2
2
100      Sample Output 1 2  There are two ways to satisfy the condition:   Select zero 500 -yen coins, one 100 -yen coin and zero 50 -yen coins.  Select zero 500 -yen coins, zero 100 -yen coins and two 50 -yen coins.        Sample Input 2 5
1
0
150      Sample Output 2 0  Note that the total must be exactly X yen.       Sample Input 3 30
40
50
6000      Sample Output 3 213

Solution (Python):
a, b, c, x = int(input()), int(input()), int(input()), int(input())
ans = 0
for i in range(a + 1):
    for f in range(b + 1):
        for j in range(c + 1):
            if 500 * i + 100 * f + 50 * j == 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):
        temp = x - 500 * a - 100 * b
        if temp % 50 != 0 or temp < 0:
            continue
        if temp // 50 <= C:
            ans += 1

print(ans)

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

Solution (Python):


import sys


input = sys.stdin.readline
INF = float('inf')


def inpl(): return list(map(int, input().split()))


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

ans = 0
for a in range(X[0] + 1):
    for b in range(X[1] + 1):
        tmp = X[3] - 500 * a - 100 * b
        q, mod = divmod(tmp, 50)
        if mod != 0 or tmp < 0:
            continue
        if q <= X[2]:
            ans += 1

print(ans)

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

ans=0
for p in range(0,a+1):
    for q in range(0,b+1):
        if x-c<=10*p+2*q and 10*p+2*q<=x:
            ans = 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 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 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())
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):
def answer(*inp):

    A = int(inp[0])
    B = int(inp[1])
    C = int(inp[2])
    X = int(inp[3])

    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)

answer(input(), input(), input(), input())

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

Solution (Python):
fh = int(input())
oh = int(input())
ft = int(input())
to = int(input())
count = 0

for i in range(fh+1):
    for n in range(oh+1):
        for s in range(ft+1):
             if 500*i+100*n+50*s == to:
                 count += 1
print(count)

Solution (Python):
fh = int(input())
oh = int(input())
ft = int(input())
to = int(input())
count = 0

for i in range(fh+1):
    for n in range(oh+1):
        for s in range(ft+1):
             if 500*i+100*n+50*s == to:
                 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):
result = 0
A = int(input()) 
B = int(input()) 
C = int(input()) 
X = int(input()) 
  
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
          if 500*a + 100*b + 50*c == X:
            result += 1
 
print(result)

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

count = 0

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

print(count)

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

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 c in range(0, C+1):
    for b in range(0, B+1):
        for a in range(0, A+1):
            if c*50 + b*100 + a*500 == 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 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 ia in range(0, min((x//500)+1,a+1)):
    y = x-500*ia
    for ib in range(0, min((y//100)+1, b+1)):
        z = y-100*ib
        if z%50 == 0 and z//50 <= c:
            ans += 1

print(ans)

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

Solution (Python):
from sys import stdin

n500 = int(stdin.readline().rstrip())
n100 = int(stdin.readline().rstrip())
n50 = int(stdin.readline().rstrip())
yen = int(stdin.readline().rstrip())

x = 0

for a in range(n500+1):
    for b in range(n100+1):
        for c in range(n50+1):
            if yen == a*500+ b*100+ c*50: 
                x += 1

print(x)

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

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):
num_500 = int(input())
num_100 = int(input())
num_50 = int(input())
X = int(input())
count = 0
for i in range(0, num_500 + 1):
  for n in range(0, num_100 + 1):
    for m in range(0, num_50 + 1):
      if (i*500 + n*100 + m*50) == X:
        count += 1
print(count)

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

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

money = []
for a_i in range(a+1):
	for b_i in range(b+1):
		for c_i in range(c+1):
			money.append(500*a_i+100*b_i+50*c_i)

cnt = 0
for m in money:
	if m == x:
		cnt+=1
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input()) 
ans = 0
        
for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            num = 500*ia+100*ib+50*ic
            if num==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())

ans = 0

for k in range(a+1):
    for l in range(b+1):
        for m in range(c+1):
            total = 500 * k + 100 * l + 50 * m
            if total == 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_origin = int(input())
i = 0
ans = 0
while i <= a:
    x_aftera = x_origin - 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, b, c, x = map(int, [input() for _ in range(4)])

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

print(n_combinations)

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
m=int(input())
s=0
for i in range(a+1):
  for j in range(b+1):
    x,y=divmod(m-i*500-j*100,50)
    if y==0 and 0<=x<=c:
      s+=1
print(s)

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

count = 0

a = 0
while a <= A:
  b = 0
  while b <= B:
    r = X - 10*a - 2*b
    if r >= 0 and r <= C:
      count += 1
    b += 1
  a += 1

print(count)

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

index1 =0
count =0
while index1<a+1:
    sum1 =0
    index2=0
    sum1+=500*index1
    while index2<b+1:
        sum2=0
        index3=0
        sum2+=100*index2
        while index3<c+1:
            sum3=0
            sum3+=50*index3
            if sum1+sum2+sum3==x:
                count+=1
            index3+=1
        index2+=1
    index1+=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 (x == (500 * i + 100 * j + 50 * k)):
                ans += 1
print(ans)

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

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

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

print(count)

Solution (Python):


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

cnt = 0

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

print(cnt)

Solution (Python):


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

cnt = 0

def judge(x,a,b,c):
    if 500*a + 100 * b + 50*c == x:
        return True
    
for i in reversed(range(a+1)):
    for j in reversed(range(b+1)):
        for k in reversed(range(c+1)):
            if judge(x, i, j, k):
                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())
res = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      total = i*500 + j*100 + k*50
      if total == x:
        res += 1
print(res)

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

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

ans = 0

for num_a in range(0, a + 1):
  for num_b in range(0, b + 1):
    for num_c in range(0, c + 1):
      if 500 * num_a + 100 * num_b + 50 * num_c == x:
        ans += 1

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
L = []
answer = 0
for i in range(A+1) :
    for j in range(B+1) :
        for k in range(C+1) :
            L.append(500*i+100*j+50*k)
for l in range(len(L)) :
    if X-L[l] == 0 :
        answer += 1
print(answer)

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

sum = 0
count = 0
for a in range(A+1):
    sum = 0
    sum = sum + a * 500

    if sum > X:
        break
    for b in range(B+1):
        sum2 = sum
        sum2 = sum2 + b * 100
        if sum2 > X:
            break

        if (X - sum2) / 50  <= C:
            count = count +1

print(count)

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

Solution (Python):
from sys import stdin

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

ans = 0
for i in range(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())

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())
k = 0
for p in range(A+1):
  for q in range(B+1):
    for r in range(C+1):
      if (10*p+2*q+r == X//50):
        k += 1
print(k)

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

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

print(ans)

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

cnt = 0

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

print(cnt)

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

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

print(ans)

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

for a in range(A+1):
    if 500 * a > X:
        break
    for b in range(B+1):
        if 500 * a + 100 * b > X:
            break
        for c in range(C+1):
            if 500 * a + 100 * b + 50 * c > X:
                break
            elif 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())
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(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_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(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_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):

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

f = 0
for ax in range(a + 1):
   for bx in range(b + 1):
      for cx in range(c + 1):
        if (ax*500+bx*100+cx*50 == x):
          f = f +1
print(f)

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

ans = 0

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

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

ok = set()

for a_num in range(a + 1):
    for b_num in range(b + 1):
        for c_num in range(c + 1):
            price = a_num * 500 + b_num * 100 + c_num * 50
            if price == x:
                ok.add((a_num, b_num, c_num))

print(len(ok))

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

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

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

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

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

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

print n

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 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):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

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

ans = 0
for n_500 in range(A+1):
	for n_100 in range(B+1):
		tmp = X - 500*n_500 - 100*n_100
		n_50 = tmp//50
		if 0 <= n_50 <= C:
			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 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())

five_x = 0
hundred_x = 0
fifty_x = 0

five = []
hundred = []
fifty = []
five.append(0)
hundred.append(0)
fifty.append(0)

for i in range(A):
    five_x += 500
    five.append(five_x)
for i in range(B):
    hundred_x += 100
    hundred.append(hundred_x)
for i in range(C):
    fifty_x += 50
    fifty.append(fifty_x)
    
money = []

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            money.append(five[i]+hundred[j]+fifty[k])

cnt = 0

for i in range(len(money)):
    if money[i] == 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 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())

N = X // 500
min1 = min(A, N)
i = k = 0

while(i <= min1):
    M = X - (500 * i)
    L = M // 100
    min2 = min(B, L)
    j = 0
    while(j <= min2):
        P = M - (100 * j)
        Q = P / 50
        if Q <= C:
            k += 1
        j += 1
    i += 1

print(k)

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
XS = str(X)
hantei = False
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())
XS = str(X)
hantei = False
count = 0

if XS[-2] == "5":
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(1, C + 1, 2):
                if (500*a)+(100*b)+(50*c) == X:
                    count += 1
else:
    for a in range(A + 1):
        for b in range(B + 1):
            for c in range(0, C + 1, 2):
                if (500*a)+(100*b)+(50*c) == X:
                    count += 1

print(count)

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

ans = 0
for i in range(A+1):
  res = X - i * 500
  if res < 0:
    break
  for j in range(B+1):
    res =  X - i * 500 - j * 100
    if res < 0:
      break
    if res % 50 == 0 and res / 50 <= C:
      ans += 1
print(ans)

Solution (Python):
import math
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):


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


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

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


if __name__ == '__main__':
    main()

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

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

print(n_selection)

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

m=0
for s in range(A+1):
    for t in range(B+1):
        for u in range(C+1):
            if 500*s+100*t+50*u==X:
                m +=1
print(m)

Solution (Python):
A,B,C,X = int(input()),int(input()),int(input()),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):
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
total = int(input())

ans = 0
for i_500 in range(coin500 + 1):
    for i_100 in range(coin100 + 1):
        for i_50 in range(coin50 + 1):
            if 500 * i_500 + 100 * i_100 + 50 * i_50 == total:
                ans += 1
print(ans)

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

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

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

count = 0

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=chk=0
for i in range(a+1):
    for j in range(b+1):
        tmp=i*500+j*100
        if x-tmp>=0 and (x-tmp)//50<=c: ans+=1
print(ans)

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

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):
c=0;
I,J,K,x=[int(input())for _ in[0]*4]
for i in range(I+1):
    for j in range(J+1):
        for k in range(K+1):
            c+=i*500+j*100+k*50==x;
print(c);

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

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

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

print(cnt)

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


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


count = 0


for num_A in range(max_A + 1):
    
    left_BC = X
    left_BC -= num_A * 500

    max_B = int(left_BC / 100)
    max_B = min(B, max_B)

    for num_B in range(max_B + 1):
        
        left_C = left_BC
        left_C -= num_B * 100

        if left_C % 50 == 0:
            if C >= int(left_C/50):
                count += 1

        

print(count)

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

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

Solution (Python):


a, b, c, x = map(int, [input() for val in range(4)])

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

print(n_pattern)

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

t = 0
for i in range(0,a+1):
    if x < 500*i:
        break
    for j in range(0,b+1):
        if x < 500*i + 100*j:
            break
        if x - 500*i - 100*j <= 50* c:
            t = t + 1
print(t)

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
res=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if x==500*p+100*q+50*r:
                res+=1
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)