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

max500=min(a,x//500)
max100=min(b,(x-max500*500)//100)
max50=min(c,(x-max500*500-max100*100)//50)
count=0


for num500 in range(a+1):
    for num100 in range(b+1):
        remain=x-num500*500-num100*100
        if remain>=0:
            if remain//50<=c:

                count+=1
print(count)

Solution (Python):
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())

goal_money = int(input())

count = 0

if goal_money < 100:
    count = 1 if coin_50 else 0
elif goal_money < 500:
    for n_50 in range(coin_50+1):
        for n_100 in range(coin_100+1):
            sum_money = 50 * n_50 + 100 * n_100

            if sum_money == goal_money:
                count += 1
else:
    for n_50 in range(coin_50+1):
        for n_100 in range(coin_100+1):
            for n_500 in range(coin_500+1):
                sum_money = 50 * n_50 + 100 * n_100 + 500 * n_500

                if sum_money == goal_money:
                    count += 1
print(count)

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

X = int(input())

an = 0

for i in range(A+1):
    if 500*(A-i) <= X:
        a = X - 500*(A-i)

        for j in range(B+1):
            if 100*(B-j) <= a:
                b = a - 100*(B-j)

                for k in range(C+1):
                    if 50*(C-k) <= b:
                        c = b - 50*(C-k)

                        if c == 0:
                            an += 1

print(an)

Solution (Python):
a, b, c, x = [int(input()) for i in range (4)]
count = 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):
import numpy as np
a, b, c, x = int(input()), int(input()), int(input()), int(input())
i = 500 * np.arange(a+1)
j = 100 * np.arange(b+1)
k = 50 * np.arange(c+1)
product = i[:, None, None]+j[None, :, None]+k[None, None, :]
print(np.count_nonzero(product==x))

Solution (Python):
from itertools import product
a, b, c, x = int(input()), int(input()), int(input()), int(input())
print(sum(500*i+100*j+50*k==x for i, j, k in product(range(a+1), range(b+1), 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 i * 500 + j * 100 + k * 50 == 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):
def t():return range(int(input())+1)
from itertools import product as p
a=0;s=p(t(),t(),t());x=int(input())
for i,j,k in s:
  if i*500+j*100+k*50==x:a+=1
print(a)

Solution (Python):
def t(): return range(int(input())+1)

from itertools import product as p

a = 0
s = p(t(),t(),t())
x = int(input())

for i, j, k in s:
    if i*500 + j*100 + k*50 == x:
        a += 1
print(a)

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

ans = 0

for xx in range(a+1):
    A = 500*xx
    for y in range(b+1):
        B = 100*y
        for z in range(c+1):
            C = 50*z
            if x == A+B+C:
                ans += 1
            else:
                continue


print(ans)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

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

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

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

print(cnt)

Solution (Python):
if __name__ == '__main__':
    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())

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

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

judg = 0

for i in range(A+1):
    a = 500 * i
    for ii in range(B+1):
        b = 100 * ii
        for iii in range(C+1):
            c =  50 * iii
            if a + b + c == X:
                judg += 1
            sum = 0

print(judg)

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 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())
 
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):
url = "https://atcoder.jp/contests/abc087/tasks/abc087_b"

def main():
    coins = [int(input()) for v in range(3)]
    che = int(input())
    count = 0
    for i in range(0, coins[0] + 1):
        for j in range(0, coins[1] + 1):
            for k in range(0, coins[2] + 1):
                if che == (500 * i) + (100 * j) + (50 * k):
                    count += 1
    print(count)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
total = 0
cnt = 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:
        cnt +=1
             
print(cnt)

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

count = 0

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

print(count)

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

print(cnt)

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

Solution (Python):
def nyu():
    num1= input()
    num2= input()
    num3= input()
    num4= input()

    num1 = int(num1)
    num2 = int(num2)
    num3 = int(num3)
    num4 = int(num4)

    
    
    return num1,num2,num3,num4


def check(A,B,C,X):
    cnt = 0

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

A,B,C,X = nyu()
check(A,B,C,X)

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

Solution (Python):
A500 = int(input())  
B100 = int(input()) 
C50 = int(input()) 
X = int(input()) 
out = 0

for a in range(A500+1):
    for b in range(B100+1):
        for c in range(C50+1):
            if X == 500*a + 100*b + 50*c:
                out = out+1

print(out)

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 i in range(4)]
res = 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:
                res += 1
print(res)

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  a = int(input())
  b = int(input())
  c = int(input())
  x = int(input())
  cnt = 0
  """for i in range(x//500 +1):
    m500 = 0
    mob = x
    if x//500 != 0:
      m500 += mob//500
      mob -=m500 * 500
    else:
      pass
    for j in range(mob//100 + 1):
      m100 = 0
      mob = x - m500 * 500
      if mob//100 != 0:
        m100 += mob//100
        mob -=m100*100
      else:
        pass
      
      mob = x - m100*100 - m500*500
      m50 = mob//50
      
      if 0 <= m500 <= a and 0 <= m100 <= b and 0 <= m50 <= c:
        cnt += 1"""
  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:
          cnt += 1
  print(cnt)
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())
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())

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

print(sum)

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

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

print(sum)

Solution (Python):
from itertools import product


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

    print(ans)


if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    main(a, b, c, x)

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

Solution (Python):
z = [input() for i in range(4)]
a = z[0]+1
b = z[1]+1
c = z[2]+1
x = z[3]
p = 0
for i in range(a):
    for j in range(b):
        for k in range(c):
            total = (500*i) + (100*j) + (50*k)
            if total == x: p+=1
print p

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


counter = 0
for aa in range(0,int(a)+1):
    for bb in range(0,int(b)+1):
        for cc in range(0, int(c)+1):
            sumx = 500 * aa + 100 * bb + 50 * cc
            if int(x) == sumx and int(x) % 50 == 0 and 50 <= int(x) <= 20000:
                counter += 1
print(counter)

Solution (Python):


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

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

print(ans)

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

INF = float('inf')


def main():
    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):
                total = 500 * a + 100 * b + 50 * c
                if total == X:
                    counter += 1

    print(counter)


if __name__ == '__main__':
    main()

Solution (Python):


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

X = X / 50

num = 0 

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if X == i * 10 + j * 2 + k:
                num += 1

print(num)

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

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

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

a = b = c = 0
count = 0
max_val = 500*a_num + 100*b_num + 50*c_num

for a in range(a_num+1):
    
    for b in range(b_num+1):
        
        for c in range(c_num+1):    
            val = 500*a + 100*b + 50*c
            if val == x:
                count += 1
print(count)

Solution (Python):

import math
import itertools
import statistics

import collections

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

print(ans)

Solution (Python):
A, B, C, X = [int(input()) for _ 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()),int(input()),int(input()),int(input())
x//=50
ans=0
for i in range(x//10+1):
    k=x-i*10
    for j in range(k//2+1):
        l=k-j*2
        ans+=(0<=i<=a and 0<=j<=b and 0<=l<=c)
print(ans)

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

cnt = 0

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

print(cnt)

Solution (Python):
k = [int(input()) for i in range(4)]
p = 0


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

print(p)

Solution (Python):
numof500 = int(input())
numof100 = int(input())
numof50  = int(input())
moneyneeded = int(input())
 
counter = 0
for i in range(numof500 + 1):
  for j in range(numof100 + 1):
    for k in range(numof50 + 1):
      if 500 * i + 100 * j + 50 * k == moneyneeded:
        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 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())
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())

total = 0
n = 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:
                n += 1

print (n)

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

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

from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    r = 0
    for ia in range(a + 1):
        for ib in range(min(b + 1, (x - ia * 500)//100 + 1)):
            r +=  (x - ia * 500 - ib * 100) // 50 <= c

    print(r)

if __name__ == '__main__':
    main()

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

from math import factorial
from itertools import combinations
from collections import Counter
from copy import deepcopy
from operator import mul
from functools import reduce

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    r = 0
    for ia in range(a + 1):
        for ib in range(min(b + 1, (x - ia * 500)//100 + 1)):
            for ic in range(min(c + 1, (x - ia * 500 - ib * 100)//50 + 1)):
                r +=  ia * 500 + ib * 100 + ic * 50 == x


    print(r)

if __name__ == '__main__':
    main()

Solution (Python):



import itertools


A_YEN = 500
B_YEN = 100
C_YEN = 50


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


A_pattern_list = range(A+1)
B_pattern_list = range(B+1)
C_pattern_list = range(C+1)

answer = 0
for A_pattern,B_pattern,C_pattern in itertools.product(A_pattern_list, B_pattern_list, C_pattern_list):
    amount = A_YEN*A_pattern + B_YEN*B_pattern + C_YEN*C_pattern
    if amount == X:
        answer +=1

print(answer)

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

total=0
count=0

for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            total=500*l + 100*m + 50*n
            if(total==X): count += 1
                
print(count)

Solution (Python):
import numpy as np
fft = np.fft.rfft
ifft = np.fft.irfft

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

U = 20000
U = 1 << U.bit_length()


def conv(x, y):
    return (ifft(fft(x, U) * fft(y, U)) + 0.5).astype(np.int64)


fA = np.zeros(U, dtype=int)
fB = np.zeros(U, dtype=int)
fC = np.zeros(U, dtype=int)

fA[np.arange(A + 1) * 500] = 1
fB[np.arange(B + 1) * 100] = 1
fC[np.arange(C + 1) * 50] = 1

fABC = conv(conv(fA, fB), fC)
ans = fABC[X]
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())
Y = 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:
        Y = Y+1

print(Y)

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
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)]
ans = 0

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

print(ans)

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

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

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

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

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

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

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

cnt = 0

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

print(cnt)

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

count = 0

for i in range(0, coins[0] + 1):
  for j in range(0, coins[1] + 1):
    for k in range(0, coins[2] + 1):
      ans = 500*i + 100*j + 50*k
      if ans == coins[3]:
        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):
        nc = (x - 500*i - 100*j) // 50
        if nc < 0 or c < nc:
            continue
        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):
            price = 500 * i + 100 * j + 50 * k
            if price == x:
                ans += 1

print(ans)

Solution (Python):
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):
                m = x
                m = m - 500*i - 100*j - 50*k
                if m == 0:
                    ans += 1

    print(ans)


if __name__ == "__main__":
    main()