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

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

for v_a in range(a+1):
    for v_b in range(b+1):
        for v_c in range(c+1):
            if v_a*500 + v_b*100 + v_c*50 == x:
                count += 1
print(count)

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

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

print(c)

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

result = 0
for a in range(cnt500+1):
    for b in range(cnt100+1):
        for c in range(cnt50+1):
           if (a*500 + b*100 + c*50) == X:
               result += 1
print(result)

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

all = []
for a in range(cnt500+1):
    for b in range(cnt100+1):
        for c in range(cnt50+1):
            all.append(a*500 + b*100 + c*50)
print(all.count(X))

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

all_set = set([])

for a in range(cnt500+1):
    tmp500 = a*500
    if tmp500 > X:
        break
    all_set.add((tmp500, 0, 0))
    for b in range(cnt100+1):
        tmp100 = b*100
        if tmp100 > X:
            break
        all_set.add((tmp500, tmp100, 0))
        for c in range(cnt50+1):
            tmp50 = c*50
            if tmp50 > X:
                break
            all_set.add((tmp500, tmp100, tmp50))

all = []
for a in all_set:
    all.append(sum(a))
print(all.count(X))

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

all_set = set([])

for i,a in enumerate(range(cnt500+1)):
    tmp500 = i*500
    if tmp500 > X:
        break
    all_set.add((tmp500, 0, 0))
    for i,b in enumerate(range(cnt100+1)):
        tmp100 = i*100
        if tmp100 > X:
            break
        all_set.add((tmp500, tmp100, 0))
        for i,c in enumerate(range(cnt50+1)):
            tmp50 = i*50
            if tmp50 > X:
                break
            all_set.add((tmp500, tmp100, tmp50))

all = []
for a in all_set:
    all.append(sum(a))
print(all.count(X))

Solution (Python):
if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    count = 0
    for ia in range(a+1):
        for ib in range(b+1):
            for ic in range(c+1):
                if 500*ia+100*ib+50*ic == x:
                    count = 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_500 = int(input()) 
B_100 = int(input()) 
C_50 = int(input()) 
X = int(input())


cnt = 0
for a in range(0,A_500+1):
    for b in range(0,B_100+1):
        for c in range(0,C_50+1):
            if a * 500 + b * 100 + c * 50 == 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):
Li = [int(input()) for _ in range(4)]
a, b, c, x = Li[0], Li[1], Li[2], Li[3]
ans = 0
for i in range(min(x//500, a)+1):
    for j in range(min((x-500*i)//100, b)+1):
        ans += 1 if (x-500*i-100*j)//50 <= c else 0
print(ans)

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

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

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())
result = 0

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

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

a_list = [0] if a==0 else range(a+1)
b_list = [0] if b==0 else range(b+1)
c_list = [0] if c==0 else range(c+1)    

count = 0

for n50 in c_list:
    s50 = 50*n50
    if s50==x:
        count += 1
    else:
        for n100 in b_list:
            s100 = s50+100*n100
            if s100==x:
                count += 1
            else:
                for n500 in a_list:
                    s500 = s100 + 500*n500
                    if s500==x:
                        count += 1
print(count)

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

if int(X // 500) < A:
    A = X // 500
if int(X // 100) < B:
    B = X // 100
if int(X // 50) < C:
    C = X // 50

count = 0

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

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

cnt = 0
for ai in range(A+1):
    for bi in range(B+1):
        for ci in range(C+1):
            total = 500*ai + 100*bi + 50*ci
            if total == X:
                cnt += 1
print(cnt)

Solution (Python):
gohyaku = int(input())
hyaku = int(input())
goju = int(input())
inp = int(input())
count = 0

for i in range(gohyaku+1):
	for k in range(hyaku+1):
		for j in range(goju+1):
			if i * 500+ k*100+j*50 == inp:
				count += 1
print(count)

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

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

Solution (Python):


amax = int(input())
bmax = int(input())
cmax = int(input())
x = int(input())

count = 0

for a in range(amax+1):
  for b in range(bmax+1):
    for c in range(cmax+1):
       if x == 500 * a + 100 * b + 50 * c:
        count+=1
        
print("{}".format(count))

Solution (Python):
import sys
import math



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

print(str(ret))

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

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

print(s)

Solution (Python):
import sys
import math

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


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

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

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

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

    count = 0

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

                if i*500 + j*100 + k*50 > X:
                    break

    print count

main()

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

Solution (Python):

def getInt(): return int(input())
A = getInt()
B = getInt()
C = getInt()
X = getInt()
cnt = 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: cnt += 1
print(cnt)

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

if __name__ == '__main__':
    main()

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

for i in range(min(X // 500, A)+1):
  Y = X - 500 * i
  for j in range(min(Y // 100, B)+1):
    Z = Y - 100 * j
    for k in range(min(Z // 50, C)+1):
      Q = Z - 50 * k
      if Q == 0:
        count += 1
      else:
        continue
print(count)

Solution (Python):
import itertools

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

count = 0
for aa, bb, cc in itertools.product(range(a + 1), range(b + 1), range(c + 1)):
    s = aa * 500 + bb * 100 + cc * 50
    if s == 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):
      amount = 500*i + 100*j + 50*k
      if amount ==x:
        ans +=1

print(ans)

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

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

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

ans = 0
for num500 in range(A+1):
    for num100 in range(B+1):
        for num50 in range(C+1):
            if 500*num500 + 100*num100 + 50*num50 == X:
                ans += 1
print(ans)

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

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

res = 0

for i in range(a+1):
    for x in range(b+1):
        for y in range(c+1):
            total = 500*i + 100*x + 50*y
            if total == d:
                res+= 1

print (res)

Solution (Python):


import numpy as np
import random


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

answer = 0
cash = X

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

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

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


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

ans = 0
for a in range(A[0]+1):
    for b in range(A[1]+1):
        for c in range(A[2] +1):
            if 500*a+100*b+c*50==A[3]:
                ans += 1
print(ans)

Solution (Python):
t = list(int(input()) for _ in range(3))
x = int(input())
c = 0
for i in range(min(x//500,t[0])+1):
    a = t[:]
    d = x-500*i
    if d <= 100*a[1]+50*a[2]:
        for j in range(a[1]+1):
            if d >= 100*j:
                r = d-100*j
                if r <= 50*a[2]:
                    c += 1
            else:
                break
print(c)

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

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

ans = 0
for count_500 in range(A+1):
    for count_100 in range(B+1):
        for count_50 in range(C+1):
            sum_money = 500*count_500 + 100*count_100 + 50*count_50
            if sum_money == X:
                ans += 1
print(ans)

Solution (Python):
c500 = int(input())
c100 = int(input())
c50 = int(input())
sumX = int(input())
retCount = 0
chk500X = sumX
for i in range(c500+1):
  for j in range(c100+1):
    for k in range(c50+1):
      if sumX == 500*i + 100 * j + 50 * k:
        retCount += 1
print(retCount)

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

Solution (Python):
def main(A, B, C, X):
    
    coins = [
        (a,b,c)
        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
    ] 
    print(len(coins))

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

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

cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if (i+j+k >= 1) and (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())

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

print(counter)

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

for ia in range(a+1):
    for jb in range(b+1):
        for kc in range(c+1):
            if(0 == (x - (ia*500 + jb*100 + kc*50))):
                count += 1

print(count)

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

print(r)

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

counter = 0

for i in range(0, a + 1):
    sum_a = i * 500
    if sum_a > x:
        continue
    for j in range(0, b + 1):
        sum_b = j * 100
        sum_ab = sum_a + sum_b
        if sum_ab > x:
            continue
        for k in range(0, c + 1):
            sum_c = k * 50
            sum_abc = sum_ab + sum_c
            if sum_abc > x:
                continue
            elif sum_abc == x:
                counter += 1

print(counter)

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

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

print(count(A, B, C))

Solution (Python):






line=[]
line.append(int(input()))
line.append(int(input()))
line.append(int(input()))
X=int(input())

count=0

for i in range(line[0]+1):
    for j in range(line[1]+1):
        for k in range(line[2]+1):
            if 500*i+100*j+50*k == X:
                count+=1

print(count)

Solution (Python):
t=[int(input())for i in range(3)]
x=int(input())
c=0
for i in range(min(x//500,t[0])+1):
    a=t[:]
    d=x-500*i
    if d<=100*a[1]+50*a[2]:
        for j in range(a[1]+1):
            if d>=100*j:
                r=d-100*j
                if r<=50*a[2]:
                    c+=1
            else:
                break
print(c)

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

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

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
a = 0
while a <= A:
    b = 0
    while b <= B:
        c = 0
        while c <= C:
            if 500*a+100*b+50*c == X:
                count+=1
            else:
                pass
            c+=1
        b+=1
    a+=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):
    ta = a * 500
    for b in range(B+1):
        tb = b * 100
        for c in range(C+1):
            if X == ta + tb + c*50:
                ans += 1

print(ans)

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

A,B,C,X = map(int, [A,B,C,X])

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

print(pattern_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())
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):
c500 = int(input())
c100 = int(input())
c50 = int(input())
n = int(input())
result = 0

for x in range(c500+1):
    for y in range(c100+1):
        for z in range(c50+1):
            if x * 500 + y *100 + z * 50 == n :
                result += 1
print(result)

Solution (Python):
info = [int(input()) for _ in range(4)]
ans = 0
for i in range(info[0] + 1):
  for j in range(info[1] + 1):
    k = (info[3] - (500*i + 100*j)) // 50
    if 0 <= k <= info[2]:
      ans += 1
print(ans)

Solution (Python):
import numpy as np
a = int(input())
b = int(input())
c = int(input())
x = int(input())

from itertools import product
alim = min(a, x // 500)
blim = min(b, x // 100)
clim = min(c, x //  50)

count = 0
for anum, bnum, cnum in product(np.arange(alim + 1), np.arange(blim + 1), np.arange(clim + 1)):
    value = anum * 500 + bnum * 100 + cnum * 50
    if value == x:
        count += 1
print(count)

Solution (Python):
import sys
lines = sys.stdin.readlines()
for n, line in enumerate(lines):
  if n == 0:
    A = int(line.strip())
  elif n == 1:
    B = int(line.strip())
  elif n == 2:
    C = int(line.strip())
  elif n == 3:
    X = int(line.strip())
  else:
    break

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

print(cnt)

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

for i in range(A + 1):
    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 _ in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(x))

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

count = 0

for 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):
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 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 ta in range(a + 1):
    for tb in range(b + 1):
        for tc in range(c + 1):
            if 500 * ta + 100 * tb + 50 * tc == x:
                ans += 1

print(ans)

Solution (Python):
NUM_500 = int(input())
NUM_100 = int(input())
NUM_050 = int(input())
price = int(input())

num_500 = 0
pattern = 0
while num_500 <= NUM_500:
    num_100 = 0
    while num_100 <= NUM_100:
        num_050 = 0
        while num_050 <= NUM_050:
            if price == 500 * num_500 + 100 * num_100 + 50 * num_050:
                pattern += 1
            num_050 +=1
        num_100 += 1
    num_500 += 1
print(pattern)

Solution (Python):
num_500 = int(input())
num_100 = int(input())
num_050 = int(input())
price = int(input())

i_500 = 0
pattern = 0
while i_500 <= num_500:
    remaining_price = price - 500 * i_500
    if remaining_price < 0:
        i_500 += 1
        continue
    i_100 = 0
    while i_100 <= num_100:
        price_500 = remaining_price - 100 * i_100
        if price_500 < 0:
            i_100 += 1
            continue
        number = price_500 / 50
        if number <= num_050:
            pattern += 1
        i_100 += 1
    i_500 += 1
print(pattern)

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

print(cnt)

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

Solution (Python):


import sys
input = sys.stdin.readline

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


cnt = sum(1 for a in range(A+1) if X - 500*a >=0 for b in range(B+1) if 0 <= X-500*a-100*b <= 50*C)
print(cnt)

Solution (Python):


import sys
input = sys.stdin.readline

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


cnt = sum(0 <= X-500*a-100*b <= 50*C for a in range(A+1) if X - 500*a>=0 for b in range(B+1))
print(cnt)

Solution (Python):


import sys
input = sys.stdin.readline

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



cnt = sum(0 <= X-500*a-100*b <= 50*C for a in range(A+1) if X - 500*a>=0 for b in range(B+1))
print(cnt)

Solution (Python):


import sys
input = sys.stdin.readline

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

cnt = 0
for i in range(A+1):
    X1 = X - 500 * i
    if X1 >= 0:
        for j in range(B+1):
            X2 = X1 - 100 * j
            if X2 >= 0:
                if X2 <= 50 * C:
                    cnt += 1

print(cnt)

Solution (Python):


import sys
input = sys.stdin.readline

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

cnt = 0
for i in range(A+1):
    X1 = X - 500 * i
    if X1 >= 0:
        for j in range(B+1):
            X2 = X1 - 100 * j
            if X2 >= 0 and X2 <= 50 * C:
                cnt += 1

print(cnt)

Solution (Python):


import sys
input = sys.stdin.readline

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

cnt = 0
for i in range(A+1):
    X1 = X - 500 * i
    if X1 == 0:
        cnt += 1
        continue
    for j in range(B+1):
        X2 = X1 - 100 * j
        if X2 == 0:
            cnt += 1
            continue
        for k in range(C+1):
            X3 = X2 - 50 * k
            if X3 == 0:
                cnt += 1
print(cnt)

Solution (Python):
import sys

input = sys.stdin.readline
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):
            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())
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
ma = x // 500
mb = x // 100
mc = x // 50
na = min([a, ma])
nb = min([b, mb])
nc = min([c, mc])
for i500 in range(na+1):
  for i100 in range(nb+1):
      current = x-500*i500-100*i100
      if current >= 0 and current <= 50*nc:
          cnt += 1
          
print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
list = []
for j in range(A+1):
    for k in range(B+1):
        for l in range(C+1):
            TOTAL = j * 500 + k * 100 + l * 50
            list.append(TOTAL)
if X in list:
    print(list.count(X))
else:
    print(0)

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

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

for an in range(a+1):
    for bn in range(b+1):
        for cn in range(c+1):
            if x == 500*an+100*bn+50*cn:
                count = count + 1
print(count)