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

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

for ai in range(a+1):
    x1 = x - 500*ai
    
    if x1 == 0:
        n += 1
        break
        
    for bi in range(b+1):
        x2 = x1 - 100*bi
        
        if x2 == 0:
            n += 1
            break
        
        for ci in range(c+1):
            x3 = x2 - 50*ci
            
            if x3 == 0:
                n += 1
                break
            

print(n)

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

for i in range(a+1):
    if x < 500*i:
        break
    for j in range(b+1):
        if x < 100*j + 500*i:
            break
        for l in range(c+1):
            sum = i*500 + j*100 + l*50
            if sum == x:
                count = count+1

print(count)

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

ll = []

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            ll.append(10*i+2*j+k)
ans = 0
for s in ll:
    if s == x//50:
        ans += 1
    else:
        pass

print(ans)

Solution (Python):

def inp():
    return(int(input()))


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

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

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

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C, X = map(int, readlines())
count = 0

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

print(count)

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

print(count)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def Yes(): print("Yes"); return
def No(): print("No"); return


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def Base_10_to_n(X, n):
  if X//n:
    return Base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def Base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





A,B,C,X = inputILs(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):
l = [int(input()) for i in range(3)]
p = int(input())
ans = 0
for i in range(l[0]+1):
    for j in range(l[1]+1):
        for k in range(l[2]+1):
            if 500*i+100*j+50*k==p:
                ans += 1
print(ans)

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

count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 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())
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())
d = 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 == d:
        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 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())
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+50*k==X :
                n+=1
            else :
                n+=0
print(n)

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

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

ans = 0

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

print(ans)

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

counter = 0

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

for aindex in range(a+1):
  for bindex in range(b+1):
    for cindex in range(c+1):
      if coinNumToSum(aindex, bindex, cindex) == x:
        counter += 1

print(counter)

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

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

print(res)

Solution (Python):
A,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())

a_max = X // 500
b_max = X // 100
c_max = X // 50

a_range = A
if A > a_max:
  a_range = a_max
b_range = B
if B > b_max:
  b_range = b_max
c_range = C
if C > c_max:
  c_range = c_max

count = 0

for i in range(c_range+1):
  for j in range(b_range+1):
    for k in range(a_range+1):
      if k * 500 + j * 100 + i * 50 == X:
        count += 1

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for moe in range(a+1):
    for ray in range(b+1):
        for rei in range(c+1):
            sum= 500*moe + 100*ray + 50*rei
            if sum == 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):
    L = X-500*i
    for j in range(B+1):
        M = L-100*j
        for k in range(C+1):
            if M == 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):
            can = 500*a_ + 100*b_ + 50*c_
            if x == can:
                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):
coin = [int(input()) for _ in range(3)]
X = int(input())
A = []
for i in range(coin[0]+1):
  for j in range(coin[1]+1):
    for k in range(coin[2]+1):
      A.append(500*i+100*j+50*k)
ans = A.count(X)
print(ans)

Solution (Python):
money500 = int(input())
money100 = int(input())
money50  = int(input())
goal     = int(input())

result = 0

for x in range(money500 + 1):
    for y in range(money100 + 1):
        for z in range(money50 + 1):
            if x * 500 + y * 100 + 50 * z == goal: result += 1

print(result)

Solution (Python):
big = int(input())
mid = int(input())
small = int(input())
input_money = int(input())

cnt = 0
for i in range(big+1):
    for j in range(mid+1):
        for k in range(small+1):
            if input_money==(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 c1 in range(0,c+1):
    for b1 in range(0,b+1):
        for a1 in range(0,a+1):
            if a1*500+b1*100+c1*50==x:
                count=count+1
print(count)

Solution (Python):
a, b, c, x = [int(input()) for i in range(4)]
count = 0
for i in range(a + 1):
	if (500 * i > x):
		break
	for j in range(b + 1):
		n = x - (500*i + 100*j)
		if n < 0:
			break
		m = n / 50
		if (m <= c):
			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):
        m = X - 500 * i - 100 * j
        if m % 50 == 0 and m >= 0 and m // 50 <= C:
            res += 1
print(res)

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

ans = 0
for gohyaku in range(A + 1):
    for hyaku in range(B + 1):
        for goju in range(C + 1):
            if gohyaku * 500 + hyaku * 100 + goju * 50 == X:
                ans += 1
print(ans)

Solution (Python):
a = int(input())+1
b = int(input())+1
c = int(input())+1
x = int(input())
ans = 0
for l in range(a):
    for m in range(b):
        for n in range(c):
            total = 500*l + 100*m + 50*n
            if total ==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())
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):
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

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


if __name__ == '__main__':
    main()

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

ans = 0

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

print(ans)

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

Solution (Python):
c500 = int(input())
c100 = int(input())
c50 = int(input())
x = int(input())

ans = 0
for i in range(c500+1):
    for j in range(c100+1):
        for k in range(c50+1):
            if i*500 + j*100 + k*50 == x:
                ans += 1
print(ans)

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

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

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):
import sys
import math
import bisect

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    x //= 50
    dp = [0] * (x + 1)
    dp[0] = 1
    for i in range(x, -1, -1):
        for j in range(1, a + 1):
            if i - 10 * j >= 0:
                dp[i] += dp[i-10*j]
    for i in range(x, -1, -1):
        for j in range(1, b + 1):
            if i - 2 * j >= 0:
                dp[i] += dp[i-2*j]
    for i in range(x, -1, -1):
        for j in range(1, c + 1):
            if i - j >= 0:
                dp[i] += dp[i-j]
    print(dp[x])

if __name__ == "__main__":
    main()

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

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

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

ans = 0

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

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

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

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

Solution (Python):
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0
wan = 0
inu = 0

a = iin()
b = iin()
c = iin()
x = iin()

neko = x//500
if neko > a:
    neko = a
for i in range(neko+1):
    nya = x-500*i
    nuko = nya//100
    if nuko > b:
        nuko = b
    for j in range(nuko+1):
        wan = nya-100*j
        if wan%50 == 0:
            if wan//50 <= c:
                inu+=1
print(inu)

Solution (Python):
import numpy as np

A = np.arange(int(input()) + 1)
B = np.arange(int(input()) + 1)
C = np.arange(int(input()) + 1)
total = int(input())
choice = 0
def abc(a, b, c):
    return 500*a + 100*b +50*c

for a in A:
    for b in B:
        for c in C:
            if abc(a, b, c) == total:
                choice += 1
print(choice)

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

Solution (Python):
import itertools

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

a_values = map(lambda n: n * 500, range(A + 1))
b_values = map(lambda n: n * 100, range(B + 1))
c_values = map(lambda n: n * 50, range(C + 1))

sums = map(sum, itertools.product(a_values, b_values, c_values))
print(len([s for s in sums if s == 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):
      tmp = 500*i + 100*j + 50*k
      if X == tmp: 
        ans +=1
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline

def main():
    ans = 0
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    for i in range(A+1):
        f = i*500
        if f == X:
            ans += 1
            break
        elif f > X:
            break
        for j in range(B+1):
            h = j*100
            if f + h == X:
                ans += 1
                break
            elif f + h > X:
                break
            for k in range(C+1):
                if f + h + k*50 == X:
                    ans += 1
                    break
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
c500=int(input())
c100=int(input())
c50=int(input())
Total_fee=int(input())
count=0
for ac in range(c500+1):
    for bc in range(c100+1):
        for cc in range(c50+1):
            temp_total=ac*500+bc*100+cc*50
            if temp_total==Total_fee:
                count+=1
print(count)

Solution (Python):
import math
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, B, C, X = [int(input()) for _ in range(4)]
cnt = 0
for a in range(A+1):
    for b in range(B+1):
        c = (X - 500*a - 100*b)//50
        if 0 <= c <= C:
            cnt += 1

print(cnt)

Solution (Python):
coins = [int(input()) for c in range(4)]
x = coins[3]
ans = 0
for i in range(coins[0]+1):
	for j in range(coins[1]+1):
		for l in range(coins[2]+1):
			if (i*500) + (j * 100) + (l * 50) == x:
				ans += 1

print(ans)

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

count = 0

for i_a in range(a + 1):
  for i_b in range(b + 1):
    for i_c in range(c + 1):
      if 500*i_a + 100*i_b + 50*i_c == x:
        count += 1
        
print(count)

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 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 money == 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):
      t = 500 * i + 100 * j + 50 * k
      if t == x:
        ans += 1
print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

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

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

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

X = []
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            X.append(500 * i + 100 * j + 50 * k)
print(X.count(x))

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

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

print(count)

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from fractions import gcd
def resolve():
    A=[int(input())for i in range(4)]
    cnt=0
    for i in range(A[0]+1):
        for j in range(A[1]+1):
            for k in range(A[2]+1):
                if 500*i+100*j+50*k==A[-1]:
                    cnt+=1
    print(cnt)
 
        

resolve()

Solution (Python):
def resolve():
    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):
                total = 500 * _a + 100 * _b + 50 * _c
                if total == x:
                    ans += 1

    print(ans)

resolve()

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

count = 0
S = 0

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

print(count)

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

sm = 0

count = 0

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

print(count)

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

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

print(res)

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

print(count)

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

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

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

cnt=0

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

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

ans = 0

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

print(ans)

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

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

print(ans)

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

Solution (Python):
fh=int(input())
oh=int(input())
ft=int(input())
x=int(input())
ans=0
for i in range(fh+1):
  for j in range(oh+1):
    for k in range(ft+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):
            total = 500 * i + 100 * j + 50 * k
            if X == total:
                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):
  if 500 * i > X:
    break
  for j in range(B + 1):
    if 500 * i + 100 * j > X:
      break
    tmp = X - 500 * i - 100 * j
    if tmp % 50 == 0 and tmp // 50 <= C:
      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 == 500*i+100*j+50*k:
                ans += 1

print(ans)

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

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

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

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

print(ans)

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