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

counter = 0

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

Solution (Python):
a,b,c,x = [int(input()) for _ in range(4)]
s = 0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r == x: s += 1
print(s)

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

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

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


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

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

X = int(input())
res = 0
for i_a in range(0, A+1):
    for i_b in range(0, B+1):
        for i_c in range(0, C+1):
            money = 500 * i_a + 100 * i_b + 50 * i_c
            if money == X:
                res += 1
print(res)

Solution (Python):
A,B,C,X = [int(input()) for i in range(4)]
ans = 0
for i_500 in range(A+1):
    for i_100 in range(B+1):
        resid = X - i_500 * 500 - i_100 * 100
        if resid >= 0:
            q,mod = divmod(resid,50)
            if C >= q and mod == 0:
                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):
    y = x-(500*i)
    for j in range(b+1):
        z = y-(100*j)
        for k in range(c+1):
            ans = z-(50*k)
            if ans==0:
                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):
    y = x-(500*i)
    for j in range(b+1):
        z = y-(100*j)
        for k in range(c+1):
            ans = z-(50*k)
            if ans==0:
                count = 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 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())

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

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
x=int(x/50)
p=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 10*i + 2*j + k == x:
                p=p+1


print(p)

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

count=0
for i in range(A+1):
    if 500*i <= X:
        for j in range(B+1):
            if 100*j <= X-500*i:
                for k in range(C+1):
                    if 50*k == X-500*i-100*j:
                        count+=1
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 500*i + 100*j + 50*k == x:
                ans += 1
print(ans)

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

ans=0
for a in range(0,A+1):
    for b in range(0,B+1):
        for c in range(0,C+1):
            if (10*a)+(2*b)+c==X//50:
                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):
        if 0 <= (X-500*i-100*j)//50 <= C:
            n+=1
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 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 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(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

def run():
 if x % 50 != 0 or a*500 + b*100 + c*50 < x:
  return 0

 
 an = 0
 bn = 0
 cn = 0
 
 xa = x
 while xa >= 500:
  xa -= 500
  an += 1
 while xa >= 100:
  xa -= 100
  bn += 1
 while xa >= 50:
  xa -= 50
  cn += 1
 if xa != 0:
  return 0 
 
 ret = 0
 while an >= 0:
  if an <= a and bn <= b and cn <= c:
   ret += 1
  if bn > 0:
   bn -= 1
   cn += 2
  else:
   an -= 1
   bn = 5 + (cn / 2)
   cn = cn % 2
 return ret
print run()

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

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):
abc = [int(input()) for x in range(3)]
x = int(input())
cnt = 0
for i in range(abc[0]+1):
    for j in range(abc[1]+1):
        for k in range(abc[2]+1):
            func = 500*i+100*j+50*k
            if func == x : cnt += 1
            else: continue
print(cnt)

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

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

for a_i in range(0, a + 1):
    if a_i * 500 > x:
        break
    for b_i in range(0, b + 1):
        for c_i in range(0, c + 1):
            if a_i * 500 + b_i * 100 + c_i * 50 == 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 500 * i + 100 * j + 50 * k == x:
                count += 1

print(count)

Solution (Python):
a0 = int(input())   
b0 = int(input())   
c0 = int(input())   
x = int(input())   

cnt = 0
for a in range(a0 + 1):
    for b in range(b0 + 1):
        for c in range(c0 + 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())

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

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

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())
result=0
for p in range(a+1):
  for q in range(b+1):
    for r in range(c+1):
      if p*500+q*100+r*50==x:
        result+=1
print(result)

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

print cnt

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

Solution (Python):


c_500 = int(input())
c_100 = int(input())
c_50 = int(input())
how = int(input())

count = 0
for i in range(c_500 + 1):
    for j in range(c_100 + 1):
        for k in range(c_50 + 1):
            if i*500 + j*100 + k*50 == how:
                count += 1
print(count)

Solution (Python):
def get_coin_comb(A, B, C, X):
    count = 0
    for i in range(A+1):
        for j in range(B+1):
            for k in range(C+1):
                sumv = 500*i + 100*j + 50*k
                if sumv == X:
                    count += 1
    return count


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

    print(get_coin_comb(a, b, c, x))

Solution (Python):

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

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

print(num)

Solution (Python):
from itertools import product
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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

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

ret = 0
for ia in range(0, a+1):
    for ib in range(0, b+1):
        for ic in range(0, c+1):
            if 500*ia + 100*ib + 50*ic == x:
                ret += 1
print(ret)

Solution (Python):
num = [0 for i in range(4)]

for i in range(4):
    num[i] = int(input())

count = 0
for i in range(num[0]+1):
    for j in range(num[1]+1):
        for k in range(num[2]+1):
            sum_1 = 500*i+100*j+50*k
            if sum_1 == num[3]:
                count += 1

print(count)

Solution (Python):
import math

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


total = 0

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

print(total)

Solution (Python):

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

counter = 0

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

print(counter)

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()



a = int(arr_data[0][0])


b = int(arr_data[1][0])


c = int(arr_data[2][0])


x = int(arr_data[3][0])


mycnt=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:
            

               
                mycnt+=1
                
print(mycnt)

Solution (Python):
A, B, C, x = map(int, [input() for i in range(4)])
ans = [ a 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 ]
print(len(ans))

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

print(count)

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

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

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

print(ans)

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

count = 0
for a in range(s[0] + 1):
    for b in range(s[1] + 1):
        for c in range(s[2] + 1):
            if( a*500 + b*100 + c*50 == s[3] ):
                count = 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())
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())

ans = 0

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

            if sum == x:
                ans += 1
            elif sum > x:
                break;


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


def main():
    a_500 = int(input())
    b_100 = int(input())
    c_50 = int(input())
    x = int(input())
    count = 0

    for a in range(a_500 + 1):
        if ((500 * a) > x):
            continue
        for b in range(b_100 + 1):
            if ((500 * a) > x):
                continue
            for c in range(c_50 + 1):
                if ((500 * a) > x):
                    continue
                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())
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):
            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())

x=[(i,j,k)for i in range(A+1) for j in range(B+1) for k in range(C+1)]
count=0
for i,j,k in x:
    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 yen_500 in range(A+1):
    for yen_100 in range(B+1):
        for yen_50 in range(C+1):
            value = 500 * yen_500 + 100 * yen_100 + 50 * yen_50
            if value == X:
                cnt += 1

print(cnt)

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

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

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

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

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

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

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

def main():
    a = [500 * k for k in range(A + 1)] 
    b = [100 * j for j in range(B + 1)]
    c = [ 50 * i for i in range(C + 1)]
    results = [am + bm + cm for am in a
                            for bm in b
                            for cm in c]
    result = results.count(X)
    print(result)

if __name__ == "__main__":
    main()

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 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())
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, 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())
t = 0

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

print(t)

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

print(t)

Solution (Python):
import itertools


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

    ans = 0

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

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

print(count)

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

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

cand = [(i, j, k) for i in range(A+1) for j in range(B+1) for k in range(C+1)]
count = 0

for c in cand:
    if 500*c[0] + 100*c[1] + 50*c[2] == X:
        count += 1
        
print(count)

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

count=0

for a in range(A+1):
    for b in range(B+1):
        r=x-a*10-b*2
        if r>=0 and r<=C:
            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):
            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())

a = [i for i in range(0,A*500+1,500)]
b = [i for i in range(0,B*100+1,100)]
c = [i for i in range(0,C*50+1,50)]
sum=0

for i in range(len(a)):
    for j in range(len(b)):
        for l in range(len(c)):
            if X == a[i] + b[j] + c[l]:
                sum = sum + 1
print(sum)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(0,A+1):
    Xa  = X - 500*a
    if Xa < 0:
        break
    for b in range(0,B+1):
        Xab = Xa - 100*b
        if Xab < 0:
            break
        for c in range(0,C+1):
            Xabc = Xab - 50*c
            if Xabc == 0:
                count += 1
                break
                
print(count)

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

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

print(res)

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

count = 0
for a in range(0, A+1):
    Xa = X - 500 * a
    if Xa < 0:
        break
    for b in range(0, B+1):
        Xab = Xa - 100 * b
        if Xab < 0:
            break
        for c in range(0, C+1):
            if Xab - 50 * c == 0:
                count += 1
                break
print(count)

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

count = 0
for a in range(0, A+1):
    Xa = X - 500 * a
    if Xa < 0:
        break
    for b in range(0, B+1):
        Xab = Xa - 100 * b
        if Xab < 0:
            break
        for c in range(0, C+1):
            if Xab - 50 * c == 0:
                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())

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

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())
X = int(input())
print(len({(a, b, c)
      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}))

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 a in range(min(A+1, X//500+1)):
    for b in range(min(B+1, X//100+1)):
        for c in range(min(C+1, X//50+1)):
            if 500*a + 100*b + 50*c == 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 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=[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):
        remain=X-i*500-j*100
        if remain >=0 and remain%50==0 and remain/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):
def solve(a,b,c,x):
    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
    return count

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

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