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-----
2
2
2
100

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

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

print(ans)


def main():

    five_hundred = int(input())
    one_hundred = int(input())
    fifty = int(input())
    x = int(input())
    ans = 0
    for i in range(five_hundred + 1):
        for j in range(one_hundred + 1):
            for k in range(fifty + 1):
                if 500 * i + 100 * j + 50 * k == x:
                    ans += 1

    print(ans)

def __starting_point():
    main()
__starting_point()

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

print(cnt)

# -*- coding:utf-8 -*-
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
rest_X = 0

for i in range(0,A+1):
    rest_X = X - 500*i
    if rest_X == 0:
        cnt+=1
        break
    elif rest_X < 0:
        break
    for j in range(0,B+1):
        rest_X = X - 500*i
        rest_X = rest_X - (100*j)
        if rest_X == 0:
            cnt+=1
            break
        elif rest_X < 0:
            break
        
        if 50*C >= rest_X:
            cnt+=1

print(cnt)

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

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)

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)

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

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

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("{}".format(count))

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)

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)


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

cnt = 0

for a_idx in range(a + 1):
  for b_idx in range(b + 1):
    for c_idx in range(c + 1):
      total = 500 * a_idx + 100 * b_idx + 50 * c_idx
      if (total == x): cnt += 1

print(cnt)

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

count = 0
# for a in range(A+1):
#     temp = X
#     if temp - 500 * a == 0:
#         count+=1
#         break
#     elif temp - 500 * a > 0:
#         temp -= 500 * a

#     for b in range(B+1):
#         temp_b = temp
#         if b != 0:
#             if temp_b - 100 * b == 0:
#                 count+=1
#                 break
#             elif temp_b - 100 * b > 0:
#                 temp_b -= 100 * b

#         if C > 0:
#             temp_c = temp_b
#             for c in range(1,C+1):
#                 if temp_c - 50 == 0:
#                     count+=1
#                     break
#                 temp_c -= 50
#     if X < 500:
#         break
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)

A = int(input())
B = int(input())
C = int(input())
X = int(input())
L = []
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:
                L.append((a,b,c))
print((len(L)))





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

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

a=int(input())
b=int(input())
c=int(input())
sum_=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):
            check=500*i+100*j+50*k
            if(check==sum_):
                count+=1
print(count)                


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)


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

print(cnt)

def main():
    a, b, c, x = (int(input())+1 for _ in range(4))
    x -= 1

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


main()

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)

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)

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

print(ans)

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)

with open(0) as f:
    a, b, c, x = map(int, f.read().split())
cnt = 0
from itertools import product
for i,j,k in product(range(a+1), range(b+1), range(c+1)):
    if 500*i + 100*j + 50*k == x:
        cnt += 1
print(cnt) 

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

cnt = 0
for a in range(A+1):
  if X < 500*a:
    continue
  y = X-(500*a)
  if y == 0:
    cnt += 1
    continue
  for b in range(B+1):
    if y < b*100:
      continue
    z = y-(100*b)
    if z == 0:
      cnt += 1
      continue
    for c in range(C+1):
      w = z-(50*c)
      if w == 0:
        cnt += 1
        break
print(cnt)

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+50*k==X:
        ans+=1

print(ans)

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)

a=int(input())
b=int(input())
c=int(input())
x=int(input())
if x%100>0 and c==0:
    print((0))
    return
else:
    a=min(a,x//500)
    b=min(b,x//100)
    c=min(c, x // 50)
    ans=0
    for i in range(a+1):
        for j in range(b+1):
            for c in range(c+1):
                if i*500+j*100+c*50==x:ans+=1
print(ans)


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)


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

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

print(count)

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)

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

    return count


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


def __starting_point():
    main()
__starting_point()

a = int(input())
b = int(input())
c = int(input())
g = int(input())
tmp = []
for x in range(a+1):
    for y in range(b+1):
        for z in range(c+1):
            tmp.append(500*x + 100*y + 50*z)
ans = tmp.count(g)
print(ans)

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)





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)

# coding: utf-8
# Your code here!

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

max_a = min(int(x/500), a)
max_b = min(int(x/100), b)
max_c = min(int(x/50), c)

cnt = 0

for i in range(max_a + 1) : 
    for j in range(max_b + 1) : 
        for k in range(max_c + 1) : 
            if i*500 + j*100 + k*50 == x : 
                cnt += 1
                
print(cnt)

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 ind in range(c+1):
            if 500*i + 100*j + 50*ind == x:
                cnt += 1

print(cnt)

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)


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

ans = 0

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


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)

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)

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

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

print(cnt)

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)

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

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    target = 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)==target:
                    count+=1
                else:
                    continue
    print(count)

def __starting_point():
    main()
__starting_point()

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 * int(i) + 100 * int(j) + 50 * int(k)
            if sum == X:
                count += 1

print(count)

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

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

print(ans)

[a]=[int(i) for i in input().split()]
[b]=[int(i) for i in input().split()]
[c]=[int(i) for i in input().split()]
[x]=[int(i) for i in input().split()]
ans=0
for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if(ia*500+ib*100+ic*50==x):
                ans+=1
print(ans)


a_coins = int(input())
b_coins = int(input())
c_coins = int(input())
x_num = int(input())

def money_match(a, b, c):
    money = 500 * a + 100 * b + 50 * c
    if money == x_num:
        return 1
    else:
        return 0
        
cnt = 0
for a in range(a_coins+1):
    for b in range(b_coins+1):
        for c in range(c_coins+1):
            if money_match(a, b, c) == 1:
                cnt += 1
                
print(cnt)

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)

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

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

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

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

print(cnt) 


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

ans = 0
for a, b, c in [(a, b, c) for a in range(A+1) for b in range(B+1) for c in range(C+1)]:
  if 10*a + 2*b + c == X:
    ans += 1

print(ans)

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

ans = 0

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

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

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

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

print(count)

A,B,C,X = list(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 = ans + 1
print(ans)


s = [int(input()) for i in range(4)]
A = s[0]
B = s[1]
C = s[2]
X = s[3]
res = 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
#      print("A:"+str(a)+" B:"+str(b)+" C:"+str(c) + "total:"+str(total))
      if(total == X):res = res +1
print(res)

getints = lambda: map(int, input().split())
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):
            val = 500 * i + 100 * j + 50 * k
            if val == x:
                ans += 1
print(ans)

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)

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


def __starting_point():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    solve(A, B, C, X)

__starting_point()

A=int(input())#500円玉
B=int(input())#100円玉
C=int(input())#50円玉
X=int(input())#合計金額。50の倍数
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=count+1
print(count)


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

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)

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

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
            elif 500 * i + 100 * j + 50 * k > x:
                break
print(cnt)

n=[int(input()) for i in range(4)]
print(sum(0<=(n[3]-500*a-100*b)//50<=n[2] and (n[3]-500*a-100*b)%50==0 for a in range(n[0]+1) for b in range(n[1]+1)))

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)

#!/usr/bin/env python3

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

print(ans)


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 ((x-(500*i+100*j))//50)<=c and (500*i+100*j)<=x:
            ans += 1
            #print(i, j)
print(ans)

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

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

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

print(result)

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)


A, B, C, X = [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 500 * a + 100 * b + 50 * c == X:
        cnt += 1
print(cnt)

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):
            total = 500*a + 100*b + 50*c
            if total==x:
                ans+=1
print(ans)

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

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

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)


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)

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)

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

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

print(ans)
            


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

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

cnt = 0
for an in range(a+1):
  for bn in range(b+1):
    for cn in range(c+1):
      if x == 500*an + 100*bn + 50*cn:
        cnt += 1
print(cnt)

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)

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


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)

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

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)


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


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)

a = int(input())
b = int(input())
c = int(input())
x1 = int(input())
x2 = 0
ans = 0

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

print(ans)


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

print(count)

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

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)

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

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


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)

(A, B, C, X) = [int(input()) for i in range(4)]
ways = 0

max_a = int( X / 500 )
if A < max_a :
  max_a = A
for a in reversed(list(range( max_a+1))) :
  max_b = int( (X - 500 * a) / 100 )
  if B < max_b :
    max_b = B
  for b in reversed(list(range( max_b+1))) :
    c = int ( ( X - 500 * a - 100 * b ) / 50 )
    if c > C :
      break
    ways += 1
print(('%d' %ways )) ;


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

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

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

A = int(input())  # 500
B = int(input())  # 100
C = int(input())  # 50
X = int(input())  

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