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

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

print(d)

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

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


count=0

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

print(str(count))

Solution (Python):
a,b,c,x = [int(input()) for _ in range(4)]
an = 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:
                an+=1
 
print(an)

Solution (Python):
coin = [int(input()) for i in range(3)]
X = int(input())
cnt = 0
for i in range(coin[0]+1):
    for j in range(coin[1]+1):
        for k in range(coin[2]+1):
            if X - ((500 * i) + (100 * j) + (50 * k)) == 0:
                cnt += 1

print(cnt)

Solution (Python):
coin = [int(input()) for i in range(3)]
X = int(input())
cnt = 0
for i in range(coin[0]+1):
    x = X
    x -= 500 * i
    y = x
    if x == 0:
        cnt += 1
        break
    for j in range(coin[1]+1):
        x = y
        x -= 100 * j
        z = x
        if x == 0:
            cnt += 1
            break
        for k in range(coin[2]+1):
            x = z
            x -= 50 * k
            if x == 0:
                cnt += 1
                break
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):
a = int(input())
b = int(input())
c = int(input())
x = int(input())

counter = 0

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

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

SUM=[]

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
            SUM.append(sum)

print(SUM.count(X))

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

R = min(C, X // 50)
if (X - 50 * R) % 100 != 0 and R > 0:
	R -= 1
Q = min(B, (X - 50 * R) // 100)
while (X - 50 * R - 100 * Q) % 500 != 0:
	if Q > 0:
		Q -= 1
	elif R > 1:
		R -= 2
	else:
		break
P = min(A, (X - 50 * R - 100 * Q) // 500)

if 500 * P + 100 * Q + 50 * R >= X:
	ans = 1
	
	while True:
		while True:
			if 50 * R >= 100 and Q < B:
				R -= 2
				Q += 1
				ans += 1
			else:
				break
	
		if 100 * Q + 50 * R >= 500 and P < A:
			P += 1
			R = min(C, (X - 500 * P) // 50)
			if (X - 50 * R) % 100 != 0 and R > 0:
				R -= 1
			Q = min(B, (X - 500 * P - 50 * R) // 100)
			ans += 1
		else:
			break

else:
	ans = 0

print(ans)

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(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

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

print result

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

print(ansCnt)

Solution (Python):


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

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

print(count)

Solution (Python):
import math


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









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

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

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

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(min(A, X//500) + 1):
  X_pool = X
  if X - 500 * i >= 0:
    X_pool = X_pool - 500 * i
    for j in range(min(B, X_pool//100) + 1):
      X_pool_2 = X_pool
      if X_pool - 100 * j >= 0:
        X_pool_2 = X_pool - 100 * j
        if X_pool_2%50 == 0 and X_pool_2//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 j in range(B+1):
    for k in range(C+1):
      ans = 500*i + 100*j + 50*k
      if ans == 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 + k*50
      if total == X:
        count +=1
        
print(count)

Solution (Python):
five = int(input())
one = int(input())
fifty = int(input())
x = int(input())
count = 0

for FIVE in range(five+1):
    for ONE in range(one+1):
        for FIFTY in range(fifty+1):
            if FIVE*500 + ONE*100 + FIFTY*50 == x:
                count += 1
print(count)

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

cnt = 0
for a500 in range(A + 1):
    if a500 * 500 > X:
        break
    for b100 in range(B+1):
        if a500 * 500 + b100 * 100 > X:
            break
        for c50 in range(C+1):
            if a500 * 500 + b100 * 100 + c50 * 50 == X:
                cnt += 1
            else:
                if a500 * 500 + b100 * 100 + c50 * 50 > X:
                    break
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:
                ans += 1
print(ans)

Solution (Python):
a, b, c = map(int, [input() for _ in range(3)])
d = int(input())
e = 0
for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if d - 500 * i - 100 * j - 50 * k == 0:
                e += 1
print(e)

Solution (Python):
aa = int(input()) + 1
bb = int(input()) + 1
cc = int(input()) + 1
x = int(input())
count = 0

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

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

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

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    a, b, c = IR(3)
    a -= b
    print(a % c)
    return


def B():
    a, b, c, x, ans = II(), II(), II(), II(), 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)
    return


def C():
    return


def D():
    return


if __name__ == '__main__':
    B()

Solution (Python):
C500 = int(input())
C100 = int(input())
C50 = int(input())
X = int(input())
count = 0
for i in range(C500+1):
  for j in range(C100+1):
    for k in range(C50+1):
      TOTAL = 500*i+100*j+50*k
      if TOTAL == X:
        count += 1
        break
print(count)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
print([500*i+100*j+50*k for i in range(a+1) for j in range(b+1) for k in range(c+1)].count(x))

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

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

print(pattern)

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())
d = [500 * a + b * 100 + c * 50 for a in range(A+1) for b in range(B+1) for c in range(C+1)]
print(d.count(x))

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

Solution (Python):
x = int(input())             
y = int(input())             
z = int(input())             
payment = int(input())

count = 0
for k in range(x + 1):
    for j in range(y + 1):
        for i in range(z + 1):
            ans = i * 50 + j * 100 + k * 500
            if ans == payment:
                count += 1

print(count)

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

for i in range(A+1) :
    for j in range(B+1):
        for k in range(C+1):
            sumX.append(500*i + 100*j + 50*k)
print(sumX.count(X))

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

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

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

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

baisu = x // 50

a_num = a * 10
b_num = b * 2
c_num = c

count = 0

for i in range(0,a_num + 1,10):
    for j in range(0,b_num + 1,2):
        num = baisu - (i + j)
        if(num >= 0 and num <= c_num):
            count += 1

print(count)

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

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

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 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())
X_div = int(X/50)
count = 0
for i in range(1+A):
    for j in range(1+B):
        for k in range(1+C):
            if(10*i + 2*j + k == X_div):
                count += 1
print(count)

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

Solution (Python):
a,b,c,x = [int(input()) for i in range(4)]
cnt = 0
for ai in range(a+1):
  for bi in range(b+1):
    for ci in range(c+1):
      sumcoin = ai*500 + bi*100 + ci*50
      if sumcoin==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):
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):
import sys
a=int(input())
b=int(input())
c=int(input())
x=int(input())


if 500*a+100*b+50*c<x:
    print(0)
    sys.exit()
elif 500*a+100*b+50*c==x:
    print(1)
    sys.exit()
elif c==0 and x%100!=0:
    print(0)
    sys.exit()
elif b==0 and c==0 and x%500!=0:
    print(0)
    sys.exit()


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):
    if i*500 > X:
        continue
    for j in range(B+1):
        if i*500 + j*100 > X:
            continue
        for k in range(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())

    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)

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

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

Solution (Python):
def main():
	A = int(input())
	B = int(input())
	C = int(input())
	X = int(input())
	ans = 0
	for i in range(A+1):
		five_h = 500*i
		if five_h > X:
			break
		for j in range(B+1):
			one_h = 100*j
			if five_h + one_h > X:
				break
			for k in range(C+1):
				fifty = 50*k
				total = five_h + one_h +fifty
				if total > X:
					break
				if total == X:
					ans += 1
	print(ans)


if __name__ == '__main__':
	main()

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

ans = 0

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

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

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

ans = 0
for i in range(0, min(a + 1, (x // 500) + 1)):
    start = min(500 * i, x)
    for j in range(0, min(b + 1, ((x - start) // 100) + 1)):
        start1 = min(start + j * 100, x)
        left = x - start1
        if left // 50 <= c:
            ans += 1
print(ans)

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

print(counter)

Solution (Python):
l=[int(input()) for i in range(4)]

all=0

for j in range(l[0]+1):
    for k in range(l[1]+1):
        for m in range(l[2]+1):
            if l[3]==500*j+100*k+50*m:
                all=all+1


print(all)

Solution (Python):
from itertools import product

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

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

Solution (Python):

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


count=0

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

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

Solution (Python):
import sys, re
input = sys.stdin.readline
a = int(input())  
b = int(input())  
c = int(input())  
x = int(input())  

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 == a_i * 500 + b_i * 100 + c_i * 50:
        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 k in range(B+1):
    for t in range(C+1):
      if 500*i+100*k+50*t==X:
        ans+=1
print(ans)

Solution (Python):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
x = list(map(int,input().split()))
A = a[0]
B = b[0]
C = c[0]
X = x[0]
Count = 0
for i in range(A+1):
    for k in range(B+1):
        for t in range(C+1):
            if 500*i + 100*k + 50*t == 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())

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

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

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

coins()

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

Solution (Python):
from sys import stdin
A = int(stdin.readline().rstrip())
B = int(stdin.readline().rstrip())
C = int(stdin.readline().rstrip())
X = int(stdin.readline().rstrip())
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):
if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

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

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

print(pattern)

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

count = 0
coin_sum = 0
for d in range(a+1):
    for e in range(b+1):
        for f in range(c+1):
            coin_sum = 500*d+100*e+50*f
            if(coin_sum == 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)]

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, B, C, X = map(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, 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):
import sys
input = sys.stdin.readline

def main():
    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)
            


if __name__ == "__main__":
    main()

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

X //= 50
ans = 0
for i in range(A+1):
    for j in range(B+1):
        if 0 <= X - 10*i - 2*j <= C:
            ans += 1
print(ans)

Solution (Python):
import math

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

cnt = 0
for i in range(min(a, math.floor(x / 500)) + 1):
  for j in range(min(b, math.floor(x / 100)) + 1):
    for k in range(min(c, math.floor(x / 50)) + 1):
      if x - i * 500 - j * 100 - k * 50 == 0:
        cnt += 1

print(cnt)

Solution (Python):
d = [int(input()) for i in range(4)]
ans = 0
for i in range(d[0]+1):
	for j in range(d[1]+1):
		for k in range(d[2]+1):
			if 500*i + 100*j + 50*k == d[3]:
				ans += 1
print(ans)

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

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

print(cnt)

Solution (Python):



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

print(count)

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

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

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

counter = 0

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

print(counter)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans=0
for ia in range(a+1):
    for ib in range(b+1):
        if 500*ia+100*ib+50*c>=x & x>=500*ia+100*ib: ans+=1
print(ans)

Solution (Python):


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

x /=50
ans_num=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			if(i*10+j*2+k == x):
				ans_num+=1

				
				
				
				
				

print(ans_num)

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

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

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

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

for i in range(0, a+1):
    asum = 500 * i
    for i in range(0, b+1):
        bsum = 100 * i
        for i in range(0, c+1):
            csum = 50 * i
            sum.append(asum + bsum + csum)

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