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())
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,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())
 
def main():
    flag = "FALSE"
    count = 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            for k in range(0, c+1):
                total = int(500*i+100*j+50*k)
                if total == x:
                    count = count + 1
                else:
                    pass
    print(count)
 
if __name__ == '__main__':
    main()

Solution (Python):
A, B, C, X = [int(input()) for i in range(4)]
num = 0
for j in range(A+1):
    for k in range(B+1):
        for m in range(C+1):
            if 500 * j + 100 * k + 50 * m == X:
                num += 1
print("{}".format(num))

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

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

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

counter = 0
for i in range(0, A+1):
    ans = X - 500 * i
    if ans > 0:
        for n in range(0, B+1):
            ans1 = ans - 100 * n
            if ans1 > 0 and (ans1 / 50) <= C:
                counter += 1
            elif ans1 == 0:
                counter += 1
    elif ans == 0:
        counter += 1
print(counter)

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

counter = 0
for i in range(0, A+1):
    for n in range(0, B+1):
        for t in range(0, C+1):
            total = 500 * i + 100 * n + 50 * t
            if total == X:
                counter += 1
print(counter)

Solution (Python):
s = [int(input()) for i in range(4)]
var = 0
for i in range(s[0]+1):
  if (s[3]-500*i) >= 0:
    Y = s[3]-500*i
    for j in range(s[1]+1):
      if ((Y-100*j) >= 0) and (((Y-100*j)//50) <= s[2]):
        var = var+1
print(var)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
var = 0
for i in range(A+1):
  if (X-500*i) >= 0:
    Y = X-500*i
    for j in range(B+1):
      if ((Y-100*j) >= 0) and (((Y-100*j)//50) <= C):
        var = var+1
print(var)

Solution (Python):



A, B, C, X = int(input()), int(input()), int(input()), int(input())
counter = 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:
                counter += 1
print(counter)

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 = [int(input()) for i in range(4)]
l = []
for x in range(a + 1):
  for y in range(b + 1):
    for z in range(c + 1):
      s = 500*x + 100*y + 50*z
      l.append(s)
print(l.count(X))

Solution (Python):
five_hnd = int(input())
one_hnd = int(input())
fifty = int(input())
target = int(input())
num = 0
for i in range(five_hnd + 1):
  for j in range(one_hnd + 1):
    for k in range(fifty + 1):
      sum = 500*i + 100*j + 50*k
      if (sum) == target :
        num +=1
print(num)

Solution (Python):

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

ans = 0

for i in range(A+1):

    for j in range(B+1):

        for k in range(C+1):

            if i*500 + j*100 + k*50 == X:

                ans += 1

print (ans)

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

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

Solution (Python):

A = int(input())

B = int(input())

C = int(input())

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

Solution (Python):
from sys import stdin

c = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
count = 0


for coin_500_num in range(0,c+1):
    for coin_100_num in range(0,b+1):
        for coin_50_num in range(0,a+1):
            total = 500*coin_500_num + 100*coin_100_num + 50*coin_50_num
            if(total == x):
                count +=1


"""
自分の。
for 文のカウンタのスコープは有効だから、for文のifはいらなかった。

for coin_500_num in range(0,c+1):
    amari = x-500*coin_500_num
    if(amari == 0):
        count += 1
    elif(amari > 0):
        for coin_100_num in range(0,b+1):
            amari_2 = amari-100*coin_100_num
            if(amari_2 == 0):
                count += 1
            elif(amari_2 > 0):
                for coin_50_num in range(0,a+1):
                    amari_3 = amari_2-50*coin_50_num
                    if(amari_3 == 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):
  if i * 500 > X:
    break
  for j in range(B + 1):
    if i * 500 + j * 100 > X:
      break
    for k in range(C + 1):
      if i * 500 + j * 100 + k * 50 == X:
        ans += 1
        break
      if i * 500 + j * 100 + k * 50 > X:
        break
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 += 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 = 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):
      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())
ans = 0

for a in range(A+1):
    for b in range(B+1):
        if (X-a*500-b*100)/50 <= C and (X-a*500-b*100)/50 >= 0:
            ans += 1

print(ans)

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A = n()
B = n()
C = n()
X = n()

count = 0
for i in range(A+1):
    for j in range(B+1):
        rest = X - (500*i + 100*j)
        if rest >= 0 and rest // 50 <= C:
            count += 1
print(count)

Solution (Python):
def main():
    a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
    cnt = 0
    for i in range(min(a, x // 500) + 1):
        for j in range(min(b, (x - 500 * i) // 100) + 1):
            if c * 50 >= x - i * 500 - j * 100:
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
n500 = int(input())
n100 = int(input())
n50 = int(input())
total = int(input())
count = 0
for i1 in range(n500+1):
    for i2 in range(n100+1):
        for i3 in range(n50+1):
            val100 = i2*100
            val500 = i1*500
            val50 = i3*50
            if val500+val100+val50 == 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):
    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 abc():
    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 a * 500 + b * 100 + c * 50 == X:
                    ans += 1
    print(ans)


abc()

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

a_list = [i for i in range(A+1)]
b_list = [i for i in range(B+1)]
c_list = [i for i in range(C+1)]

count = 0
for a in a_list:
    for b in b_list:
        for c in c_list:
            if X == 500*a+100*b+50*c:
                count += 1
print(count)

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

Solution (Python):
a, b, c, x = [int(input()) for _ in range(4)]
count = 0
for i in range(0,a+1):
    if 10*i > x/50:
            break
    for j in range(0,b+1):
        if 2*j > x/50:
            break
        for k in range(0,c+1):
            if k > x/50:
                break
            if 10*i+2*j+k == x/50:
                count += 1
print(count)

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

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 + 50 * c == X:
                cnt += 1
print(cnt)

Solution (Python):
a,b,c,x=list(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):
        if (x-500*i-100*j) % 50 == 0 and 0 <= (x-500*i-100*j) // 50 <= c:
            ans += 1
print(ans)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
x=int(input())
z=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:
        z+=1
print(z)

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

print(cnt)

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

cnt=0

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

print(cnt)

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

Solution (Python):

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

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

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

for i in range(A):
    for j in range(B):
        for k in range(C):
            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())
counti = 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:
        counti += 1

print(counti)

Solution (Python):
order = [int(input()) for i in range(4)]
A = order[0]
B = order[1]
C = order[2]
X = order[3]
count = 0

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

Solution (Python):
import itertools
A = range(int(input()) + 1)
B = range(int(input()) + 1)
C = range(int(input()) + 1)
X = int(input())

ptn = list(itertools.product(A, B, C))
cnt = 0
for i in ptn:
        if i[0] * 500 + i[1] * 100 + i[2] * 50 == X:
                cnt += 1

print(cnt)

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

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

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

Solution (Python):
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b, c, x = [int(input()) for i in range(4)]
    
    res = 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:
                    res += 1
    
    print(res)

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):
            s = a * 500 + b * 100 + c * 50
            
            if s == X:
                count += 1

print(count)

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

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

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

print(pattern)

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

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

aa = (n // 500) + 1
bb = (n // 100) + 1
cc = (n // 50) + 1

cnt = 0

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

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

A, B, C, X = [int(sys.stdin.readline()) for _ in range(4)]
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            ans += a*500+b*100+c*50 == X

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

print(count)

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


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

print(answer)

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, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
ans = 0
for i in range(min(a, x // 500) + 1):
    for j in range(min(b, (x - i * 500) // 100) + 1):
        rest = x - (i * 500 + j * 100)
        if rest <= c * 50:
            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):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict
import math


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def mod_inv(x):
    
    global mod
    return pow(x, mod - 2, mod)


def gcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    ret = math.factorial(x)
    ret = ret // (math.factorial(x - y) * math.factorial(y))

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    a500 = intin()
    b100 = intin()
    c50 = intin()
    x = intin()

    ans = 0

    for i in range(a500 + 1):
        xx = x
        xx -= 500 * i
        if xx < 0:
            break
        for j in range(b100 + 1):
            xxx = xx
            xxx -= 100 * j
            if xxx < 0:
                break
            if xxx >= 0 and xxx % 50 == 0 and  xxx // 50 <= c50:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):

import sys


def solve(A: int, B: int, C: int, X: int):

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



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    X = int(next(tokens))  
    solve(A, B, C, X)

if __name__ == '__main__':
    main()

Solution (Python):
import re  
import sys 


def i_input(): return int(input())
def s_input(): return map(int,input().split())
def l_input(): return list(map(int, input().split()))


def check(x, a, b, c):
    diff = x - 500 * a - 100 * b
    if diff >= 0 and diff % 50 == 0 and diff // 50 <= c:
        return True
    else:
        return False

def main():
    a = i_input() 
    b = i_input() 
    c = i_input() 
    x = i_input() 

    count = 0
    for i in range(a + 1):
        for j in range(b + 1):
            if check(x, i, j, c):
                count += 1

    print(count)

if __name__ == "__main__":
    main()

Solution (Python):
L=[int(input()) for i in range(4)]
ans=0
for i in range(L[0]+1):
  for j in range(L[1]+1):
    for k in range(L[2]+1):
      ans+=1 if i*500+j*100+k*50==L[3] 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):
    for j in range(B+1):
        for k in range(C+1):
            if (i*500+j*100+k*50) == X:
                count += 1
print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 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 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())
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())
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):
    sum = 500*i
    if sum == x:
        count += 1
    else:
        for j in range(b+1):
            sum_100 = 100*j
            if sum + sum_100 == x:
                count += 1
            else:
                for k in range(c+1):
                    sum_50 = 50*k
                    if sum + sum_100 + sum_50 == x:
                        count += 1
print(count)

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

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

print(ans)

Solution (Python):
int_list = [int(input()) for _ in range(4)]
res = 0
for n_500 in range(int_list[0] + 1):
  for n_100 in range(int_list[1] + 1):
    for n_50 in range(int_list[2] + 1):
      if n_500 * 500 + n_100 * 100 + n_50 * 50 == int_list[3]:
        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):
      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 = 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):
if __name__ == '__main__':
    A, B, C, X = [int(input()) for x in range(4)]
    count = 0
    
    for A_coin in range(A + 1):
        
        for B_coin in range(B + 1):
            
            for C_coin in range(C + 1):
                
                if ((A_coin * 500) + (B_coin * 100) + (C_coin * 50)) == X: count += 1
                    
    print(count)

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

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

print(cnt)

Solution (Python):
a = 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):
n500= int(input())
n100= int(input())
n50= int(input())
total = int(input())

count500,count100,count50 =0,0,0
hit = 0
for i in range(0,n500+1):
  count500 =i
  for i in range(0,n100+1):
    count100 =i
    for i in range(0,n50+1):
      count50 =i
      if (count500*500 + count100*100 + count50* 50) == total:
        hit +=1

print(hit)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())//50
ans = 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:
                ans += 1

print(ans)

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

count = 0

for i in range(min(a,x//500)+1): 
    remains = x - 500 * i
    for j in range(min(b,remains//100)+1):
        Remains = remains - 100 * j
        for k in range(min(c,Remains//50)+1):
            fifty = Remains - 50 * k
            if fifty == 0:
                count = count + 1
            else: continue

print(count)

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

for i in range(z[0]+1):
  for j in range(z[1]+1):
    for k in range(z[2]+1):
      if 500*i + 100*j + 50*k == z[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):
        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())

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

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):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    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 a*500 + b*100 + 50*c == X:
                    ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()