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):
import sys


num_coins_500 = int(input())
num_coins_100 = int(input())
num_coins_50 = int(input())
total = int(input())


if not 0<=num_coins_50<=50 or not 0<=num_coins_100<=50 or not 0<=num_coins_500<=50 or not 50<=total<=20000:
    sys.exit()


flag = 0


for i in range(0, num_coins_50+1, 1):
    for j in range(0, num_coins_100+1, 1):
        for k in range(0, num_coins_500+1, 1):
            
            
            if total ==  50*i + 100*j + 500*k:
                    
                flag += 1
                    
print(flag)

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

Solution (Python):


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

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

    print(n)


if __name__ == '__main__':
    main()

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


abc087_b()

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 l in range(C+1):
            if 500*i + 100*j + 50*l == 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):
  s = 500 * i
  for j in range(b + 1):
    t = 100 * j
    for k in range(c + 1):
      u = 50 * k
      if s + t + u == x:
        count += 1

print(count)

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

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

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()) for i in range(4)]


cnt=0
for i in range(a[0]+1):
  for j in range(a[1]+1):
    for k in range(a[2]+1):
      if 500*i+100*j+50*k==a[3]:
        cnt+=1
        
print(cnt)

Solution (Python):




def  selectPattern(a500yen,b100yen,c50yen,total):
	a500yenRange = range(0,a500yen+1)
	b100yenRange = range(0,b100yen+1)
	c50yenRange = range(0,c50yen+1)
	nowPattern = 0
	for a in a500yenRange:
		thisTotal = 0
		for b in b100yenRange:
			for c in c50yenRange:
				thisTotal = a*500+b*100+c*50
				if thisTotal == total :
					nowPattern = nowPattern+1

	answer = nowPattern
	return answer


if __name__ == '__main__':
	a500yen = int(input())
	b100yen = int(input())
	c50yen = int(input())
	total = int(input())
	solution=selectPattern(a500yen,b100yen,c50yen,total)
	print(solution)

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

def enable_pay(target, coin, n):
    if 0 <= target // coin <= n:
        return True
    return False

count = 0
for a_n in range(0, a+1)[::-1]:
    for b_n in range(0, b+1)[::-1]:
        s = (500 * a_n) + (100 * b_n)
        if enable_pay(x-s, 50, c):
            count += 1
print(count)

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

Solution (Python):

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

pattern = 0
for a500 in range(A+1) :
    for b100 in range(B+1) :
        for c50 in range(C+1) :
            if (a500 * 500 + b100 * 100 + c50 * 50 == X) :
                pattern += 1

print(pattern)

Solution (Python):
if __name__ == "__main__":
    COIN = (500, 100, 50)

    v = []
    for i in range(4):
        v.append( int(input()) )
    
    i, j, count = 0, 0, 0

    while i <= v[0] and i*COIN[0] <= v[3]:
        while j <= v[1] and j*COIN[1] <= (v[3]-i*COIN[0]):
            if v[2]*COIN[2] >= (v[3]-i*COIN[0]-j*COIN[1]):
                count += 1
            j += 1
        j = 0
        i += 1

    print(count)

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

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

count=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):
                    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 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())

cnt = 0
tmp_x = X
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
        break
print(cnt)

Solution (Python):
import itertools


def main():
    A = int(input()) + 1
    B = int(input()) + 1
    C = int(input()) + 1
    X = int(input())

    cnt = 0
    for n_500, n_100, n_50 in itertools.product(range(A), range(B), range(C)):
        y = 500 * n_500 + 100 * n_100 + 50 * n_50
        if y == X:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np

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

Solution (Python):


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

Solution (Python):
f_h,h,f_t,total = map(int,[input() for _ in range(4)])
ans = 0
for i in range(f_h+1):
    for j in range(h+1):
        for k in range(f_t+1):
            if 500*i + 100*j + 50*k == total:
                ans += 1
        
        
print(ans)

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

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

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

a, b, c = (0, 0, 0)

counter = 0

for a in range(A+1):
	
	'''
	if X == sum_c:
		counter += 1
		break
	elif sum_c > X:
		break
	'''
	for b in range(B+1):
	
		'''
		if X == sum_bc:
			counter += 1
			break
		elif sum_bc > X:
			break
		'''
		for c in range(C+1):
			if X == a * 500 + b * 100  + c * 50:
				counter += 1
				


print(counter)

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

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

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

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

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

print(ans)

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

Solution (Python):
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
x = int(input())

ans = 0
for c1 in range(coin500 + 1):
    for c2 in range(coin100 + 1):
        for c3 in range(coin50 + 1):
            if 500 * c1 + 100 * c2 + 50 * c3 == x:
                ans += 1

print(ans)

Solution (Python):
A, B, C, X = int(input()), int(input()), int(input()), int(input())
cnt = 0
for n_500 in range(A + 1):
    for n_100 in range(B + 1):
        for n_50 in range(C + 1):
            if n_500 * 500 + n_100 * 100 + n_50 * 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 = int(input())
B = int(input())
C = int(input())
X = int(input())
res=0
for  i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500*i + 100*j + 50*k == X:
                res += 1
print(res)

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


'''
問題：
    あなたは500円玉をA枚、100円玉をB枚、50円玉をC枚持っています。
    これらの硬貨の中から何枚かを選び、合計金額をちょうどX円にする方法は何通りありますか。

    同じ種類の硬貨同士は区別できない。
    2通りの硬貨の選び方は、ある種類の硬貨についてその硬貨を選ぶ枚数が異なる時区別される。

制約：
    0 <= A,B,C <= 50
    A+B+C >= 1
    50 <= X <= 20,000
    A, B, C は整数である。
    Xは50の倍数である。

入力：
    入力は以下の形式で標準入力から与えられる。

    A
    B
    C
    X

出力：
    硬貨を選ぶ方法の個数を出力せよ。
'''




five = int(input()) 
hundred = int(input()) 
fifty = int(input()) 
total = int(input()) 


used50 = 0
used100 = 0
used500 = 0
usedTotal = 0
ways = 0

while used500 <= five:
    while used100 <= hundred:
        while used50 <= fifty:
            usedTotal = 50 * used50 + 100 * used100 + 500 * used500

            if total == usedTotal:
                ways += 1
            used50 += 1
        used50 = 0
        used100 += 1

    used50 = 0
    used100 = 0
    used500 += 1






print(ways)

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

for i in range(min(int(X/500)+1, A+1)):
    for n in range(min(int((X-500*i)/100)+1, B+1)):
        if C >= int((X-500*i-100*n)/50):
            count += 1
    

print(count)

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

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

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(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)

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

Solution (Python):


if __name__ == "__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):
                val = i*500 + j*100 + k*50
                if val == x:
                    count += 1

    print(count)

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

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

print(k)

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

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

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):
            total = 500 * i + 100 * j + 50 * k
            
            if total == 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):
        xij = x - 500 * i - 100 * j
        if xij >= 0 and xij // 50 <= c and xij % 50 == 0:
            ans += 1
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):
            sum = 500*i + 100*j + 50*k
            if sum == 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())
x = int(input())

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

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

count = 0

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

print(count)

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

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

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

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

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

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=0
b=0
Counter=0
while a<=A:
  while b<=B:
    if 0<=X-500*a-100*b<=50*C:
      Counter+=1
    b+=1
  b=0  
  a+=1
print(Counter)

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

print(count)

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

  
x = abcx[3]
count = 0
for a in range(abcx[0]+1):
  for b in range(abcx[1]+1):
    for c in range(abcx[2]+1):
      if 500*a + 100*b + 50*c == x:
        count += 1
print(str(count))

Solution (Python):
five_hun = int(input())
hun = int(input())
fifty = int(input())
yen = int(input())
count = 0

for i in range(five_hun + 1):
    for j in range(hun + 1):
        for k in range(fifty + 1):
            if i * 500 + j * 100 + k * 50 == yen:
                count += 1

print(count)

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

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

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

print(res)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            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 a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            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 a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            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())
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(0, A+1):
    xi = X - 500 * i
    if xi < 0: break
    for j in range(0, B+1):
        xj = xi - 100 * j
        if xj < 0: break
        for k in range(0, C+1):
            xk = xj - 50 * k
            
            if xk == 0: ans += 1
            if xk < 0: 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):
			sum = 500*i+100*j+50*k
			if(x%50==0 and sum == x):
				count+=1

print(count)

Solution (Python):
def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][0] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

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

Solution (Python):



all = []

for i in range(4):
    all.append(input())
    
a, b, c  = all[:-1]

X = all[-1]

result = 0
for i in range(int(a)+1):
    for j in range(int(b)+1):
        for k in range(int(c)+1):
          total = i*500 + j*100 + k*50          
          if(total==int(X)):
              result+=1
            
            
print(result)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
s=0
count=0
i=0
while i<=C:
        j=0
        while j<=B:
            k=0
            while k<=A:
                s=i*50+j*100+k*500
                if s>X:
                    break
                elif s==X:
                    count+=1
                k+=1
            j+=1
        i+=1
print(count)

Solution (Python):
import sys

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

Solution (Python):
import sys

a = int(sys.stdin.readline().strip())
b = int(sys.stdin.readline().strip())
c = int(sys.stdin.readline().strip())
x = int(sys.stdin.readline().strip())

max_500 = int(x/500)
max_500 = min(max_500, a)

count = 0
for i in range(max_500 + 1):
    res = x - 500 * i
    max_100 = int(res/100)
    max_100 = min(max_100, b)
    for j in range(max_100 + 1):
        num_50 = int((res - 100 * j)/50)
        if num_50 <= c:
            count += 1
print(count)

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

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

print(c)

Solution (Python):
a,b,c,x = [int(input()) for i in [0]*4]
p_A = [p*500 for p in range(1,a+1)]
p_B = [q*100 for q in range(1,b+1)]
p_C = [r*50 for r in range(1,c+1)]

list_AB = sum([sum([1 for j in p_B if i+j == x]) for i in p_A])
list_BC = sum([sum([1 for j in p_C if i+j == x]) for i in p_B])
list_CA = sum([sum([1 for j in p_A if i+j == x]) for i in p_C])
list_ABC = sum([sum([sum([1 for k in p_C if i+j+k == x]) for j in p_B]) for i in p_A])
a_1 = sum([[0,1][x in i] for i in (p_A,p_B,p_C)])

print(a_1 + list_AB + list_BC + list_CA + list_ABC)

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

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

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

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

pattern = 0
for ai in range(A+1):
    for bi in range(B+1):
        for ci in range(C+1):
            if X == 500 * ai + 100 * bi + 50 * ci:
                pattern = pattern + 1
print(pattern)

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

print(a)

Solution (Python):
num1=int(input())
num2=int(input())
num3=int(input())
sum_n=int(input())

a=0
for i in range(num1+1):
    sum_n1=sum_n-500*i
    
    if sum_n1<0:
        break
    for i in range(num2+1):
        sum_n2=sum_n1-100*i
        if sum_n2<0:
            break
        for i in range(num3+1):
            if i==sum_n2/50:
                a+=1
                
print(a)

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

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

Solution (Python):
A, B, C, X = map(int, [input() for _ in range(4)])
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):
def Amount(i, j, k):
    return 500*i + 100*j + 50*k


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==Amount(i,j,k)):
                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 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());
n = 0;
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            re = 500 * i + 100 * j + 50 * k;
            if ( re == x ):
                n += 1;
            if ( re >= x ):
                re = 0;
                continue;

print(n);

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

print(ans)

Solution (Python):



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


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 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
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a = ni()
b = ni()
c = ni()
x = ni()

ans = 0

for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            if 500*ai + 100*bi + 50*ci == x:
                ans += 1
                
print(ans)

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

Solution (Python):

import math

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

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

Solution (Python):


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

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