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

for a in range(min(A, X // 500) + 1):
    leave500 = X - a * 500
    for b in range(min(B, leave500 // 100) + 1):
        leave100 = leave500 - b * 100
        if leave100 // 50 <= C and leave100 % 50 == 0:
            count += 1

print(count)

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

print(ans)

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

Solution (Python):





if __name__ == '__main__':
    five_hundred_yen_count = int(input())
    one_hundred_yen_count = int(input())
    fifty_yen_count = int(input())
    total_yen = int(input())

    pattern_count = 0

    for i in range(five_hundred_yen_count + 1):
        for j in range(one_hundred_yen_count + 1):
            for k in range(fifty_yen_count + 1):
                summed_yen = 500 * i + 100 * j + 50 * k

                if total_yen - summed_yen == 0:
                    pattern_count += 1

    print(pattern_count)

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

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())
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):
n1 = int(raw_input())
n2 = int(raw_input())
n3 = int(raw_input())
x = int(raw_input())

y1 = 500
y2 = 100
y3 = 50

n = 0
for i in range(min(n1,x/y1)+1):
  xn = x - i*y1
  for j in range(min(n2,xn/y2)+1):
    xn = x - i*y1 - j*y2
    if (0<=xn<=n3*y3):
      n += 1
      k = xn/y3
      
print n

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())
N500 = X // 500
R1 = X % 500
N100 = R1 // 100
R2 = R1 % 100
N50 = R2 // 50
count = 0
if R2 % 50 != 0:
	print(count)
	exit(0)
li = []
while N500>=0:
	while N100>=0:
		li.append((N500, N100, N50))
		N100 -= 1
		N50 += 2
	N100 = (N50 - 2) // 2
	N50 = (N50 - 2) % 2
	N500 -= 1
	N100 += 5

for n500, n100, n50 in li:
	if n500<=A and n100<=B and n50<=C:
		count += 1

print(count)

Solution (Python):
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
X = int(input())
count = 0

for i in range(coin500, -1, -1):
    if i*500 > X:
        continue
    for j in range(coin100, -1, -1):
        if i*500 + j*100 > X:
            continue
        for k in range(coin50, -1, -1):
            if 500*i+100*j+50*k == X:
                count += 1
print(count)

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

Solution (Python):
n500 = int(input())
n100 = int(input())
n50 = int(input())
X=int(input())
count = 0
for i500 in range(n500+1):
    for i100 in range(n100+1):
        for i50 in range(n50+1):
            if i500*500+i100*100+i50*50==X:
                count+=1
print(count)

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

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

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

if a * 500 + b *100 + c * 50 < x:
    print(0)
else:
    count = 0
    for a_n in range(a+1):
        for b_n in range(b+1):
            for c_n in range(c+1):
                if (a_n * 500) + (b_n * 100) + (c_n * 50) == x:
                    count += 1
                else:
                    continue
    print(count)

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

cnt = 0

for a in range(A+1):
    S1 = a*500
    if S1 > X:
        break
    for b in range(B+1):
        S2 = S1 + b*100
        if S2 > X:
            break
        for c in range(C+1):
            S3 = S2 + c*50
            if S3 > X:
                break

            if S3 == 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):
import math
import numpy as np
from operator import mul



















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

print(ans)

Solution (Python):
GI = lambda: int(raw_input()); GIS = lambda: map(int, raw_input().split())

def main():
  A = GI()
  B = GI()
  C = GI()
  X = GI()

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

  print(waze)

main()

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

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

Solution (Python):

A = int(raw_input())
B = int(raw_input())
C = int(raw_input())
X = int(raw_input())
count = 0
a = 0
while a <= A:
    b = 0
    c = 0
    A_price = 500 * (a)
    while b <= B:
        c = 0
        B_price = 100 * b
        while c <= C:
            C_price = 50 * c
            if A_price + B_price + C_price == X:
                count += 1
            c += 1
        b += 1
    a += 1
print count

Solution (Python):

def solve(A, B, C, X):
    r = 0
    for i in range(0, A + 1):
        for j in range(0, B + 1):
            t = i * 500 + j * 100
            if t > X:
                break
            if 0 <= (X - t) / 50 <= C:
                r += 1
    return r

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

if __name__ == '__main__':
    print(solve(A, B, C, X))

Solution (Python):

def solve(A, B, C, X):
    r = 0
    for i in range(0, A + 1):
        for j in range(0, B + 1):
            for k in range(0, C + 1):
                t = i * 500 + j * 100 + k * 50
                if t == X:
                    r += 1
    return r

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

if __name__ == '__main__':
    print(solve(A, B, C, X))

Solution (Python):
def fc(c, x):
    if(x > c * 50):
        return 0;
    return 1;

def fb(b, c, x):
    ans = 0;
    if(b > 0 and x >= 100):
        ans += fb(b-1, c, x-100);
    ans += fc(c, x);
    return ans;

def fa(a, b, c, x):
    ans = 0;
    if(a > 0 and x >= 500):
        ans += fa(a-1, b, c, x-500);
    ans += fb(b, c, x);
    return ans;


a = int(input())
b = int(input())
c = int(input())
x = int(input())
    
print(fa(a, b, c, x))

Solution (Python):
import itertools

A = list(range(int(input()) + 1))
B = list(range(int(input()) + 1))
C = list(range(int(input()) + 1))
X = int(input())
count = 0

abc_list = list(itertools.product(A, B, C))
for a, b, c in abc_list:
    if 500 * a + 100 * b + 50 * c == X:
        count += 1
print(count)

Solution (Python):
def main():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    
    count = 0
    for ai in [x*500 for x in range(A+1)]:
        Xa = X - ai
        if Xa < 0: break
        for bi in [x*100 for x in range(B+1)]:
            Xb = Xa - bi
            if Xb < 0: break
            for ci in [x*50 for x in range(C+1)]:
                Xc = Xb - ci
                if Xc < 0: break

                if Xc == 0:
                    count += 1
    return count
if __name__ == '__main__':
    print(main())

Solution (Python):
def main():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    
    if 500 > X: A = 0
    if 100 > X: B = 0
    count = 0
    for ai in [x*500 for x in range(A+1)]:
        Xa = X - ai
        for bi in [x*100 for x in range(B+1)]:
            Xb = Xa - bi
            for ci in [x*50 for x in range(C+1)]:
                Xc = Xb - ci
                if Xc == 0:
                    count += 1
    return count
if __name__ == '__main__':
    print(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):
            temp = 500 * i + 100 * j + 50 * k
            if temp == x:
                ans += 1
            elif temp > x:
                break
        if 500 * i + 100 * j > 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):
            
            if X==(i*500+j*100+k*50):
                count+=1

print(count)

Solution (Python):

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

x = X // 50

cnt = 0

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:
                cnt += 1
            else:
                c += 1
        b += 1
    a += 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 500*i + 100*j + 50*k - x == 0:
                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 X == i*500 + j*100 + k*50:
                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 (i*500 + j*100 + k*50 == X):                                     
                count = 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):
def B_Coins():
    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):
            y = (X-(500*i+100*j))/50
            if y >=0 and y <= C:
                count += 1
    print(count)

B_Coins()

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

counter = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            s = 500*i + 100*j + 50*k
            if s == x:
                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 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 a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            sum = a * 500 + b * 100 + c * 50
            if sum == 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(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):



def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    cnt = 0
    for i in range(a + 1):
        y = x - 500 * i
        if y <= 0:
            if y == 0:
                cnt += 1
            break
        for j in range(b + 1):
            z = y - 100 * j
            if z <= 0:
                if z == 0:
                    cnt += 1
                break
            if z // 50 <= c:
                cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

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

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())
dp = [0 for i in range(1010)]
dp[0] = 1
for i in range(1000, -1, -1):
    if(dp[i] > 0):
        for j in range(1, C + 1):
            dp[i + 1 * j] += dp[i]
for i in range(1000, -1, -1):
    if(dp[i] > 0):
        for j in range(1, B + 1):
            dp[i + 2 * j] += dp[i]
for i in range(1000, -1, -1):
    if(dp[i] > 0):
        for j in range(1, A + 1):
            dp[i + 10 * j] += dp[i]
print(dp[X // 50])

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):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a = I()
    b = I()
    c = I()
    x = I() // 50
    r = [0] * (x+1)
    r[0] = 1
    u = [0] * (x+1)
    for i in range(c):
        if i+1 > x:
            break
        r[i+1] = 1
    for i in range(1,b+1):
        for j in range(x):
            if i*2+j > x:
                break
            u[i*2+j] += r[j]
    for i in range(x+1):
        r[i] += u[i]
    u = [0] * (x+1)
    for i in range(1,a+1):
        for j in range(x):
            if i*10+j > x:
                break
            u[i*10+j] += r[j]
    for i in range(x+1):
        r[i] += u[i]

    return r[x]



print(main())

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
                continue

print(Ans)

Solution (Python):
a = [int(input()) for i in range(4)]
yen500 = a[0]
yen100 = a[1]
yen50 = a[2]
target = a[3]

count = 0
for i1 in range(yen500+1):
  for i2 in range(yen100+1):
    for i3 in range(yen50+1):
      if i1*500 + i2*100 + i3*50 == target:
        count += 1
print(count)

Solution (Python):
a, b, c, x = [int(input()) for _ in range(4)]
cnt = 0
for ai in range(0, a+1):
    for bi in range(0, b+1):
        for ci in range(0, c+1):
            if 500*ai + 100*bi + 50*ci == x:
                cnt += 1
print(cnt)

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

ANS = []
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 X == ans:
                 ANS.append(ans)
print(len(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())
correct_count = 0
for A_i in range (A+1):
    for B_i in range(B+1):
        for C_i in range(C+1):
            if X == 500*A_i+100*B_i+50*C_i:
                correct_count = correct_count + 1
print(correct_count)

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
num = 0
ai = 0
while True:
    asum = 500*ai
    if asum > x or ai > a:
        break
    bi = 0
    while True:
        bsum = asum + bi*100
        if bsum > x or bi > b:
            break
        ci = 0
        while True:
            csum = bsum + ci*50
            if csum > x or ci > c:
                break
            if csum == x:
                num += 1
            ci += 1
        bi += 1
    ai += 1
print(num)

Solution (Python):
def calc(A, B, C, X):
    result = 0
    for i in range(A + 1):
        for j in range(B + 1):
            res = X - 500 * i - 100 * j
            if res >= 0 and res / 50 <= C:
                result += 1

    return result


if __name__ == '__main__':
    A = int(input())  
    B = int(input())  
    C = int(input())  
    X = int(input())

    print(calc(A, B, C, X))

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


if __name__ == '__main__':
    main()

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

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

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

print(yen.count(int(input())))

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


if __name__ == '__main__':
    main()

Solution (Python):
a = input()
b = input()
c = input()
x = 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):
list = [int(input()) for i in range (4)]
num=0
for i in range (list[0]+1):
    for j in range (list[1]+1):
        for k in range (list[2]+1):
            if 500*i+100*j+50*k == list[3]:
                num += 1
                
print (num)

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

print(cnt)

Solution (Python):
ans = 0
fhun = int(input())
hun = int(input())
fif = int(input())
money = int(input())
for i in range(fhun + 1):
  for j in range(hun + 1):
    for l in range(fif + 1):
      if (500 * i + 100 * j + 50 * l) == money:
        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):
                reX = (X - 500*i - 100*j)//50
                if 0 <= reX <= C:
                        count+=1
   
   
print(count)

Solution (Python):
def getInt():
	return int(input())

A = getInt()
B = getInt()
C = getInt()
X = getInt()

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

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
l = 0
 
def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (500 * a + 100 * b + 50 * c < x):
			return 0
		elif (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0
 
ans = pattern(a, b, c, x)
 
print(ans)

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

l = 0

def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (500 * a + 100 * b + 50 * c < x):
			return 0
		elif (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0

ans = pattern(a, b, c, x)

print(ans)

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

l = 0

def pattern(a, b, c, x):
	if x == 0:
		return 1
	else:
		if (x >= 500) and (a >= 1):
			return pattern(a - 1, b, c, x - 500) + pattern(0, b, c, x)
		elif (x >= 100) and (b >= 1):
			return pattern(a, b - 1, c, x - 100) + pattern(a, 0, c, x)
		elif (x >= 50) and (c >= 1):
			return pattern(a, b, c - 1, x - 50) + pattern(a, b, 0, x)
		else:
			return 0

ans = pattern(a, b, c, x)

print(ans)

Solution (Python):
import sys

if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    pattern = 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: pattern += 1
    print(pattern)

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

print(cnt)

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

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

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

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

print(n)

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

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

print(cnt)

Solution (Python):
coinA = int(input())
coinB = int(input())
coinC = int(input())
want = int(input())
ways = 0
i = 0
while i <= coinA:
    j = 0
    while j <= coinB:
        k = 0
        while k <= coinC:
            if i*500 + j*100 + k*50 == want:
                ways = ways + 1
            k = k + 1
        j = j + 1
    i = i + 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):
		for k in range(c + 1):
			if 500 * i + 100 * j + 50 * k == x:
				cnt += 1

print(cnt)

Solution (Python):
def number_of_ways(a, b, c, x):
    ways = 0
    for a_count in range(a + 1):
        for b_count in range(b + 1):
            for c_count in range(c + 1):
                temp_sum = 500 * a_count + 100 * b_count + 50 * c_count
                if temp_sum == x:
                    ways += 1
    return ways

if __name__ == '__main__':
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    print(number_of_ways(a, b, c, x))

Solution (Python):
A = int(raw_input())
B = int(raw_input())
C = int(raw_input())
X = int(raw_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, b, c, x = map(int, open(0).read().split())
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(raw_input())
b=int(raw_input())
c=int(raw_input())
x=int(raw_input())

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

Solution (Python):


import sys

a = int(raw_input().split()[0])
b = int(raw_input().split()[0])
c = int(raw_input().split()[0])
x = int(raw_input().split()[0])
n = 0
for an in range(0, a + 1):
    if 500*an > x:
        break
    for bn in range(0, b + 1):
        if (500*an + 100*bn) > x:
            break
        for cn in range(0, c + 1):
            if (500*an + 100*bn + 50*cn) > x:
                break
            if (500*an + 100*bn + 50*cn) == x:
                n += 1
              
sys.stdout.write('%d\n' % n)
sys.stdout.flush()

Solution (Python):
import itertools

info = [int(input()) for i in range(4)]
A = (i for i in range(info[0]+1))
B = (i for i in range(info[1]+1))
C = (i for i in range(info[2]+1))

P_L = list(itertools.product(A, B, C))
ans = 0

for ele in P_L:
    if 500*ele[0] + 100*ele[1] + 50*ele[2] - info[3] == 0: ans += 1

print(ans)

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

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

for i in range(a+1):
    if 500 * i <= x:
        y=x - 500 * i
        for j in range(b+1):
            if j * 100 <= y:
                z=y - 100 * j
                for k in range(c+1):
                    if z - k * 50 == 0:
                        n += 1
print(n)