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):
import numpy as np
import itertools

tanka = np.array([500, 100, 50])
count = 0
A = int(input())
B = int(input())
C = int(input())
X = int(input())


a = [a for a in range(A+1)]
b = [b for b in range(B+1)]
c = [c for c in range(C+1)]


itr_res = np.array(list(itertools.product(a, b, c)))


itr_res = itr_res[1:]

for r in itr_res:
    
    if X == sum(r * tanka):
        count += 1
print(count)

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

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

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

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

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

y = []
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            y.append(500 * a + 100 * b + 50 * c)

print(y.count(X))

Solution (Python):

import sys
x = [int(input()) for _ in range(4)]
ans = 0
for i in range(x[0]+1):   
    for j in range(x[1]+1): 
        if x[3]-i*500-j*100 >=  0 and x[3]-i*500-j*100 <= x[2]*50:
            ans += 1
print(ans)

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

print([500*a+100*b+50*c for c in range(C+1) for b in range(B+1) for a in range(A+1)].count(X))

Solution (Python):



def input_one_number():
    return int(input())


def input_multiple_number():
    return map(int, input().split())


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


def input_map():
    return [list(map(int,list(input()))) for i in range(h)]


def print_list(list):
    print(*list)
    return


def print_map(maplist):
    for i in maplist:print(*i, sep='')
    return


def generate_primenums():
    n = 100
    primes = set(range(2, n+1))
    for i in range(2, int(n**0.5+1)):
        primes.difference_update(range(i*2, n+1, i))
    primes=list(primes)
    return primes

def memo():
    a=[0]*5
    b=a  
    b2=a[:]  
    a[1]=3
    print('b:{}, b2:{}'.format(b,b2))  
    
    import copy
    a= [[0]*3 for i in range(5)] 
    b=copy.deepcopy(a)  
    
    
    odd=[i for i in range(100) if i%2==1] 

    
    import bisect
    a = [1, 2, 3, 5, 6, 7, 8, 9]
    b=bisect.bisect_left(a, 8)

    
    from itertools import permutations, combinations,combinations_with_replacement,product
    a=['a','b','C']
    print(list(permutations(a)))
    print(list(combinations(a,2)))
    print(list(combinations_with_replacement(a,3)))



def kaijo(n):
    import math
    return math.factorial(n)


def num_combination(n,r):
    import math
    return math.factorial(n) // math.factorial(n - r)



def calc_gcd(a,b):
    import fractions
    GCD=fractions.gcd(a,b)
    lcm=a*b//gcd
    return gcd,lcm


def calc_gcd_list(l):
    import numpy as np
    return np.gcd.reduce(l)

A = input_one_number()
B = input_one_number()
C = input_one_number()
X = input_one_number()

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

Solution (Python):
def getInput():
    return int(input())

_500 = getInput()
_100 = getInput()
_50  = getInput()
X = getInput()

cnt = 0
for A in range(_500 + 1):
    for B in range(_100 + 1):
        for C in range(_50 + 1):
            calc =  500*A + 100*B + 50*C
            if calc == X:
                cnt += 1

print(cnt)

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

count = 0
tmp = 0

for i in range(a,-1,-1) :
  tmp_500 = 500 * i
  if tmp_500 > x :
    continue

  for j in range(b,-1,-1) :
    tmp_100 = tmp_500 + j * 100
    if tmp_100 > x :
      continue

    for k in range(c,-1,-1) :
      tmp_50 = tmp_100 + k * 50
      
      if tmp_50 > x :
        continue
      elif tmp_50 == x :
        count += 1

print(count)

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

count = 0
for ai in range(a+1):
    a_val = 500 * ai
    for bi in range(b+1):
        b_val = 100 * bi
        for ci in range(c+1):
            c_val = 50 * ci
            sum_val = a_val + b_val + c_val
            if sum_val == x:
                count += 1

print(count)

Solution (Python):
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 i*500 + j*100 + k*50 == N:
                count += 1
                
                

print(count)

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):
            if 500*ai + 100*bi + 50 *ci ==x:
                cnt += 1
print(cnt)

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):
            if 500*ai+100*bi+50*ci==x:
                cnt += 1
print(cnt)

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

count = 0

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

print(count)

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

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

Solution (Python):

import numpy as np

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

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

Solution (Python):




n = 4
m = [0]*n
counter = 0
for i in range(n):
  m[i] = int(input())

for i in range(m[0]+1):
  for ii in range(m[1]+1):
    for iii in range(m[2]+1):
      if (m[3] == i*500+ii*100+iii*50):
        counter = counter + 1
        
print(counter)

Solution (Python):




n = 4
m = [0]*n
counter = 0
for i in range(n):
  m[i] = int(input())

for i in range(m[0]+1):
  mod = m[3] - 500*i
  if (mod < 0):
    continue
  for ii in range(m[1]+1):
    mod_2 = mod - 100*ii
    if (mod_2 < 0):
      continue
    if (mod_2 <= m[2]*50):
      counter = counter + 1

print(counter)

Solution (Python):
fiveh = int(input())
oneh = int(input())
fifty = int(input())
n = int(input())

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

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

count=0

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

    if a * 500 > X:
        break

    x_a = X - a * 500
    for b in range(0, B + 1):
        if b * 100 == x_a:
            ans += 1
            break

        if b * 100 > x_a:
            break
        
        x_b = x_a - b * 100
        for c in range(0, C + 1):
            if c * 50 == x_b:
                ans += 1
                break

            if c * 50 > x_b:
                break

print(ans)

Solution (Python):

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

res = 0

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

print(res)

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

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

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

Solution (Python):
n_500,n_100,n_50=int(input()),int(input()),int(input())
price=int(input())
count=0
for i in range(n_500+1):
    for j in range(n_100+1):
        for k in range(n_50+1):
            if price==500*i+100*j+50*k:
                count+=1
print(count)

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

ans = 0

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

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
a2 = x // 500
if a <= a2:
  a2 = a
abcs = []
for i in range(int(a2) + 1):
  xi = x - 500*i
  b2 = xi // 100
  if b <= b2:
    b2 = b
  for j in range(int(b2)+1):
    xj = xi - 100*j
    k = int(xj / 50)
    if k <= c:
      abc = []
      abc.append(i)
      abc.append(j)
      abc.append(k)
      abcs.append(abc)
print(len(abcs))

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

print(cnt)

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

n = 0

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

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

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, B, C, X = map(int, [input() for i in  range(4)])
counter = 0
numA=min(X//500, A)
for a in range(0,numA+1):
    numB=min((X-500*a)//100,B)
    for b in range(0, numB+1):
        for c in range(0, C+1):
            if (X-500*a-100*b)-50*c==0:
                counter+=1
print(counter)

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

ans=0
i=0
j=0
while(i<=a and i*500<=x):
    while(j<=b and (i*500 + j*100) <=x):
        rest=x-i*500-j*100
        if(rest%50==0):
            k=rest//50
            if(0<=k and k<=c):

                ans+=1
        j+=1
    i+=1
    j=0
print(ans)

Solution (Python):
import sys

if __name__ == "__main__":
    args = sys.stdin.read().split()
    count_of_500_coins, count_of_100_coins, count_of_50_coins, sum_of_price = tuple(map(int, args))

    cnt = 0
    for num_500_coins in range(0, count_of_500_coins + 1):
        remaining_price = sum_of_price - 500 * num_500_coins
        if remaining_price < 0:
            break

        for num_100_coins in range(0, count_of_100_coins + 1):
            remaining_price = sum_of_price - 500 * num_500_coins - 100 * num_100_coins
            if remaining_price < 0:
                break

            necessary_num_50_coins = remaining_price / 50
            if 0 <= necessary_num_50_coins <= count_of_50_coins:
                cnt += 1

    print(cnt)

Solution (Python):

"""AtCoder Beginner Contest 087: B - Coins
https://atcoder.jp/contests/abc086/tasks/abc087_b
"""

__author__ = 'bugttle <bugttle@gmail.com>'


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

    result = 0
    for a_i in range(A+1):
        for b_i in range(B+1):
            for c_i in range(C+1):
                if a_i*500 + b_i*100 + c_i*50 == X:
                    result += 1

    print(result)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
aa = int(input())
bb = int(input())
cc = int(input())
x = int(input())

count = 0

for a in range(aa+1):
    for b in range(bb+1):
        for c in range(cc+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())

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

print(ans)

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


l = [500*a+100*b+50*c for a in range(A+1) for b in range(B+1) for c in range(C+1)]
print(l.count(X))

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

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):
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    
    count = 0

    for yen500 in range(A+1):
        for yen100 in range(B+1):
            for yen50 in range(C+1):
                total = 500 * yen500 + 100 * yen100 + 50 * yen50
                if X == total:
                    count += 1
                total = 0

    print(count)

if __name__ == '__main__':
    main()

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

l1 = [500*i for i in range(0, a+1)]
l2 = [100*i for i in range(0, b+1)]
l3 = [50*i for i in range(0, c+1)]

count = 0
for i in l1:
   for j in l2:
      y = x - i - j
      if (y in l3):
         count += 1
print(count)

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

for na in range(a+1):
    for nb in range(b+1):
        for nc in range(c+1):
            if (500 * na + 100 * nb + 50 * nc) == x:
                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 = int(input())
B = int(input())
C = int(input())
X = int(input())

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

print(r)

Solution (Python):
A,B,C,X=[int(input()) for i in range(4)]
cnt = 0
for a in range(0,A+1):
    Y = X - 500*a
    if Y==0:
        cnt += 1
        break
    elif Y<0:
        break
    for b in range(0,B+1):
        Z = Y - 100*b
        if Z==0:
            cnt += 1
            break
        elif Z<0:
            break
        for c in range(0,C+1):
            W = Z - 50*c
            if W == 0:
                cnt += 1
print(cnt)

Solution (Python):
A,B,C,X=[int(input()) for i in range(4)]
cnt = 0
for a in range(0,A+1):
    Y = X - 500*a
    if Y==0:
        cnt += 1
        continue
    elif Y<0:
        continue
    for b in range(0,B+1):
        Z = Y - 100*b
        if Z==0:
            cnt += 1
            continue
        elif Z<0:
            continue
        for c in range(0,C+1):
            W = Z - 50*c
            if W == 0:
                cnt += 1
print(cnt)

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

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

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

print(count)

Solution (Python):

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

X=int(input())
sumlist=[]

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

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

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

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

def exist_combination(A,B,C,target):
  count = 0
  for ai in range(A+1):
    for bi in range(B+1):
      for ci in range(C+1):
        s = ai*500 + bi*100 + ci*50
        if s == target:
          count += 1                  
  return count

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

Solution (Python):
value=[input().rstrip() for i in range(4)]
value=list(map(int,value))

a=value[3]
answer=0
for i in range(0,value[0]+1):
    fake=a-500*i
    if fake==0:
        answer+=1
        break
    else:
        for j in range(0,value[1]+1):
            if j>0:
                fake=fake-100
            if fake==0:
                answer+=1
                
            elif fake>0 and fake<=50*value[2]:
                answer+=1




print(answer)

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())
print([0 <= X - 500*a - 100*b and (X - 500*a - 100*b) %
       50 == 0 and (X - 500*a - 100*b) // 50 <= C for a in range(A+1) for b in range(B+1)].count(True))

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

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

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

print(count)

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

ans = set()
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if X == (a*500 + b*100 + c*50):
        ans.add((a,b,c))
print(len(ans))

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

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

print(cont)

Solution (Python):


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

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

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

count = 0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 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())

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

Solution (Python):
import sys
input = sys.stdin.readline
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 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())

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

print(count)

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

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):
import sys
input = sys.stdin.readline
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(A + 1):
    x = 500 * i
    if x == X:
        ans += 1
        break
    elif x > X:
        break
    for j in range(B + 1):
        x = 500 * i + 100 * j
        if x == X:
            ans += 1
            break
        elif x > X:
            break
        for k in range(C + 1):
            x = 500 * i + 100 * j + 50 * k
            if x == X:
                ans += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(A + 1):
    x = 500 * i
    if x == X:
        ans += 1
        break
    elif x > X:
        break
    for j in range(B + 1):
        x = 500 * i + 100 * j
        if x == X:
            ans += 1
            break
        elif x > X:
            break
        for k in range(C + 1):
            x = 500 * i + 100 * j + 50 * k
            if x == 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):
        if (X-(i*500 + j*100)) / 50 <= C and X-(i*500 + j*100) >= 0:
            cnt+=1

print(cnt)

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

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

Solution (Python):
import functools

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

if min(A, B, C, X) == X:
	print(0)

@functools.lru_cache(1000)
def num_patterns(A, B, C, X):
    if X == 0:
      	return 1

    if min(A, B, C, X) == X:
        return 0

    if A > 0:
        return sum(
            num_patterns(0, B, C, X - 500 * nA) if X >= 500 * nA else 0
            for nA in range(0, A + 1)
        )
    if B > 0:
        return sum(
            num_patterns(0, 0, C, X - 100 * nB) if X >= 100 * nB else 0
            for nB in range(0, B + 1)
        )
    if C > 0 and X % 50 == 0 and X / 50 <= C:
        return 1
    else:
        return 0

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

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

count=0
for a1 in range(a+1):
  for b1 in range(b+1):
    for c1 in range(c+1):
      if x==500*a1+100*b1+50*c1:
        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 = int(input())
b = int(input())
c = int(input())
x = int(input())

s = a + b + c

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

            if money == x:
                count += 1


      
print(count)