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):
def main():
    coin_500 = int(input())
    coin_100 = int(input())
    coin_50 = int(input())
    target_val = int(input())

    ans_num = 0

    for c_500 in range(coin_500+1):
        for c_100 in range(coin_100+1):
            for c_50 in range(coin_50+1):
                if c_500 * 500 + c_100*100 + c_50*50 == target_val:
                    ans_num += 1
    print(ans_num)

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

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

count = 0
for count_500 in range(0, num_500 + 1):
    sum_500 = count_500 * 500
    for count_100 in range(0, num_100 + 1):
        sum_100 = count_100 * 100
        for count_050 in range(0, num_050 + 1):
            sum_050 = count_050 * 50
            if total == (sum_500 + sum_100 + sum_050):
                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 + 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(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 = int(input())
B = int(input())
C = int(input())
X = int(input())//50

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

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

Solution (Python):

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

count = 0
for i in range(A+1) :
    for j in range(B+1) :
        for k in range(C+1) :
            if X == 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_list = []
k = 0
while k <= a:
  m = 0
  while m <= b:
    n =0
    while n <= c:
      hoge = k*500+m*100+n*50
      ans_list.append(hoge)
      n += 1
    m += 1
  k += 1
print(ans_list.count(x))

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

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

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

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

ans = 0

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

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

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

Solution (Python):
Num500, Num100, Num50, sum = [int(input()) for i in range(4)]

count=0
for i_500 in range(Num500+1):
    for i_100 in range(Num100+1):
        for i_50 in range(Num50+1):
            if 500 * i_500 + 100 * i_100 + 50 * i_50 == sum:
                count += 1

print(count)

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

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

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

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

print(cnt)

Solution (Python):
def read_plus_1():
    return(int(input())+1)


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

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

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

Solution (Python):

def main():
    A = int(input()) 
    B = int(input()) 
    C = int(input()) 
    X = int(input())
    
    answer = []
    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.append([i,j,k])
    print(len(answer))

if __name__ == "__main__":
    main()

Solution (Python):
list = []
for i in range(4):
    list.append(int(input()))


a = 0
b = 0
c = 0
res = 0
for a in range(list[0]+1):
    for b in range(list[1]+1):
        for c in range(list[2]+1):
            total = 500*a + 100*b + 50*c
            if total == list[3]:
                res += 1
print(int(res))

Solution (Python):
list = []
for i in range(4):
    list.append(int(input()))



a = 0
b = 0
c = 0
res = 0
for a in range(list[0]+1):
    for b in range(list[1]+1):
        for c in range(list[2]+1):
            total = 500*a + 100*b + 50*c
            if total == list[3]:
                res += 1
print(int(res))

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

atta = 0
for i in range(a+1):
  for j in range(b+1):
    if 0 <= x-500*i-100*j and x-500*i-100*j <= 50*c:
      
      atta +=1

print(atta)

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

for e in range(a+1):
  for f in range(b+1):
    for g in range(c+1):
      if (e*500+f*100+g*50)==x:
        count =count+1
print(count)

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

a = sum([sum(el)==x for el in 
               product(
                   np.arange(a+1)*500, np.arange(b+1)*100, np.arange(c+1)*50
               )])
print(a)

Solution (Python):
amax = int(input())
bmax = int(input())
cmax = int(input())
x = int(input())
q = 0
for a in range(amax+1):
    for b in range(bmax+1):
        for c in range(cmax+1):
            if 500*a+100*b+50*c == x:
                q += 1
print(q)

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

ans = []
mon = 0

for fh in range(a+1) :
    for h in range(b+1) :
        for f in range(c+1) :
            mon = f * 50 + h * 100 + fh * 500
            ans.append(mon)
print(ans.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 l in range(C + 1):
            if (500*i + 100*j + 50*l) == 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(min((x//500), a) +1):
  for j in range(min((x-500*i)//100, b) +1):
    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())

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

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

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

print(count)

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

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

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

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):
    result = X-(i*500+j*100)
    if result >= 0 and result - 50*C <= 0:
      cnt +=1

print(cnt)

Solution (Python):
tmp =[]
for i in range(4):
    array = int(input())
    tmp.append(array)

A=tmp[0]
B=tmp[1]
C=tmp[2]
x=tmp[3]

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

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

Solution (Python):
A,B,C,x=[int(input()) for _ in range(4)]
a=x//500
b=x//100
c=x//50
ans=0
for s in range(0,a+1):
  for t in range(0,b+1):
    u=(x-500*s-100*t)//50
    if all([0<=s<=A,0<=t<=B,0<=u<=C]):
      ans+=1
print(ans)

Solution (Python):

import sys
input = lambda: sys.stdin.readline().strip()

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

    cnt = 0
    for i_a in range(min(int(X/500),A)+1):
        X_a = X-500*i_a
        for i_b in range(min(int(X_a/100),B)+1):
            X_b = X_a - 100*i_b
            for i_c in range(min(int(X_b/50),C)+1):
                X_c = X_b - 50*i_c
                if X_c==0:
                    cnt += 1
    print(cnt)

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):
            tmp = i*500 + j*100 + k*50
            if tmp == 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())
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):
def readinput():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    return (a,b,c,x)

def main(a,b,c,x): 
    result = []
    for na in range(a+1):
        residue = x - 500*na
        if (residue < 0):
            break
        for nb in range(b+1):
            residue = x - 500*na - 100*nb
            if(residue < 0):
                break
            nc = residue // 50
            if (nc > c):
                break
            result.append((na,nb,nc))
    return result

def main_(a,b,c,x): 
    result = []
    for na in range(a+1):
        residue = x - 500*na
        if (residue < 0):
            break
        for nb in range(b+1):
            residue = x - 500*na - 100*nb
            if(residue < 0):
                break
            nc = residue // 50
            if (nc > c):
                continue
            result.append((na,nb,nc))
    return result

def main2(a,b,c,x):
    result = []
    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):
                    result.append((na,nb,nc))
                    break
    return result

def main3(a,b,c,x):
    result = []
    for na in range(a+1):
        for nb in range(b+1):
            res = x - na*500 - nb*100
            nc = res // 50
            if (0<= nc and nc <= c):
                result.append((na,nb,nc))
                continue
    return result

if __name__ == '__main__':
    a,b,c,x = readinput()

    result=main_(a,b,c,x)
    for res in result:
        (na,nb,nc)=res


    print(len(result))

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

count = 0
for x in range(A + 1):
    for y in range(B + 1):
        for z in range(C + 1):
            if X == 500 * x + 100 * y + 50 * z:
                count = count + 1

print(count)

Solution (Python):
from itertools import product


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

    coins_500 = range(A+1)
    coins_100 = range(B+1)
    coins_50 = range(C+1)

    ans = 0
    for c in product(coins_500, coins_100, coins_50):
        if c[0]*500+c[1]*100+c[2]*50 == 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(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):
def resolve():
    
    
    
    
    
    N = [int(input()) for i in range(4)]
    
    
    
    

    result = 0
    cntA_max = min(N[3] // 500, N[0])

    for i in range(N[0]+1):
        for j in range(N[1]+1):
            for k in range(N[2]+1):
                if 500 *i + 100 *j + 50 *k == N[3]:
                    result += 1

    print(result)


resolve()

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

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

print(D)

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    A = int(_in[0])
    B = int(_in[1])
    C = int(_in[2])
    X = int(_in[3])
    
    cnt = 0
    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                if 500*a+100*b+50*c==X:
                    cnt += 1
    
    print(cnt)

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 sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


a=I()
b=I()
c=I()
x=I()
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
                break
print(cnt)

Solution (Python):
c1, c2, c3, money = [int(input()) for i in range(4)]

counta = 0

for i in range(c1+1):
    for j in range(c2+1):
        if 0 <= (money - 500*i - 100*j)/50 <= c3:
            counta += 1

print(counta)

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_num in range(A+1):
	for b_num in range(B+1):
		for c_num in range(C+1):
			if (500 * a_num) + (100 * b_num) + (50 * c_num) == X:
				ans += 1

print(ans)

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

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, B, C, X = [int(input()) for i in range(4)]
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())

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 = count + 1

print(count)

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

cnt = 0

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

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












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, B, C, X = [int(input()) for _ in range(4)]

max_a = min(X//500, A)
c = 0

for a in range(0, max_a+1):
    rest1 = X - 500 * a
    max_b = min(rest1//100, B)
    for b in range(0, max_b+1):
        rest2 = rest1 - 100 * b
        if rest2//50 <= 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):
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

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

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

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

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

print(ans)

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

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

print(count)

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

for a in range(A+1):
    sum_a = 500 * a
    for b in range(B+1):
        sum_b = 100 * b
        for c in range(C+1):
            sum_c = 50 * c
            total_sum = sum([sum_a, sum_b, sum_c])
            if total_sum == X:
                count += 1

print(count)

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

for a_500 in range(A+1):
    for b_100 in range(B+1):
        for c_050 in range(C+1):
            value = (500 * a_500) + (100 * b_100) + (50 * c_050)
            if value == X:
                count += 1

print(count)

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

counter = 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:
        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 X==500*i+100*j+50*k:
                ans+=1
            else:
                pass

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
values = [500*a + 100*b + 50*c for a in range(A+1) for b in range(B+1) for c in range(C+1)]
counter = 0
for value in values:
  if value == X:
    counter+=1
print(counter)

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 l in range(c+1):
            sums = 500*i + 100*j + 50*l
            if sums==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):
            sum = 500*i + 100*j + 50*k
            if sum == 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())
ans = 0

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

print(ans)

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

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

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

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

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(0,A+1):
	for b in range(0,B+1):
		for c in range(0,C+1):
			if a * 500 + b * 100 + c * 50 == X: 
				ans = ans + 1
print(ans)

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

ans = 0

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

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

Solution (Python):


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

LIMIT = 20000
count = 0
for a in range(A + 1):
    if a * 500 > x:
        break
    for b in range(B + 1):
        if a * 500 + b * 100 > x:
            break
        for c in range(C + 1):
            fee = a * 500 + b * 100 + c * 50
            if fee > x:
                break
            elif fee == 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())

count = 0

for i in range(A+1):
    tmp = X - 500 * i
    if tmp >0:
        for j in range(B+1):
            tmp2 = tmp - 100 * j
            if tmp2 > 0:
                for k in range(C+1):
                    tmp3 = tmp2 - 50 * k
                    if tmp3 == 0:
                        count += 1
            elif tmp2==0:
                count += 1
    elif tmp==0:
        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 X < 500 * a:
        break
    for b in range(0, B + 1):
        if X < 500 * a + 100 * b:
            break
        c = (X - 500 * a - 100 * b) / 50
        if c <= C:
            ans += 1
        b += 1
    a += 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):
            tmp=500*i+100*j+50*k
            if tmp==x:
                cnt+=1
            elif tmp>x:
                break
print(cnt)