Problem:
 Score : 200 points    Problem Statement You have A  500 -yen coins, B  100 -yen coins and C  50 -yen coins (yen is the currency of Japan).
In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.      Constraints  0 \leq A, B, C \leq 50  A + B + C \geq 1  50 \leq X \leq 20  000  A , B and C are integers.  X is a multiple of 50 .         Input Input is given from Standard Input in the following format:  A  B  C  X       Output Print the number of ways to select coins.        Sample Input 1 2
2
2
100      Sample Output 1 2  There are two ways to satisfy the condition:   Select zero 500 -yen coins, one 100 -yen coin and zero 50 -yen coins.  Select zero 500 -yen coins, zero 100 -yen coins and two 50 -yen coins.        Sample Input 2 5
1
0
150      Sample Output 2 0  Note that the total must be exactly X yen.       Sample Input 3 30
40
50
6000      Sample Output 3 213

Solution (Python):
a,b,c,d=[int(input()) for i in range(4)]
x = 0
for l in range(a+1):
  for m in range(b+1):
    for n in range(c+1):
      if (500*l + 100*m + 50*n) == d:
        x +=1
print(x)

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

print(count)

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

count = 0
n = x // 50
for aa in range(a + 1):
    for bb in range(b + 1):
        for cc in range(c + 1):
            val = aa * 10 + bb * 2 + cc
            if val == n:
                count += 1
print(count)

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

Solution (Python):
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

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

input = lambda: stdin.readline().rstrip()
main()

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 _ in range(0,C+1):
            if 500*i+100*j+_*50 == 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=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):
      ans+=[0,1][500*i+100*j+50*k==x]
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, b, c, x = [int(input()) for _ in range(4)]
count=0
a2 = x // 500 
if a < a2: 
    a3 = a
else: 
    a3 = a2
for i in range(a3+1):
    y = x -500*i
    b2 = y//100
    if b < b2:
        b3 = b
    else:
        b3 = b2
    for j in range(b3 + 1):
        z = y - 100 * j
        if z // 50 <= c:
            count += 1
print(count)

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

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

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

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

print(count)

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, b, c, x = [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 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())

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

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            if 500*ai+100*bi+50*ci == x:
                count += 1
print(count)

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

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

if cnt > 0 :
  print(cnt)
else:
  print(0)

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

if __name__ == '__main__':
    print(main())

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):
five_hund = int(input())
hund = int(input())
fifty = int(input())
total = int(input())

ptn = 0

for i in range(0, five_hund+1):
  for j in range(0, hund+1):
    for k in range(0, fifty+1):
      if total == i * 500 + j * 100 + k * 50:
        ptn += 1
    
print(ptn)

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for aa in range(a+1):
    ay = 500*aa
    if ay <= x:
        for bb in range(b+1):
            by = 100*bb
            if ay + by <= x:
                for cc in range(c+1):
                    cy = 50*cc
                    if ay + by + cy ==x:
                        count += 1
                        break
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):
count = 0
A, B, C, X = map(int, [input() for i in range(4)])
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):
arr = [input() for i in range(4)]
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)

Solution (Python):
arr = [input() for i in range(4)]
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
print(len([1 for B in range(b+1) for C in range(c+1) if (x-(100*B)-(50*C))%500==0 and (x-(100*B)-(50*C))>=0 and (x-(100*B)-(50*C))<=500*a]))

Solution (Python):
import itertools

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

cnt=0

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

Solution (Python):
import itertools

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

cnt=0

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

Solution (Python):
import itertools

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

res=[]

for a,b,c in itertools.product(A,B,C):
    res.append(500*a+100*b+50*c)
    
print(res.count(X))

Solution (Python):
a,b,c,x=[int(input()) for i in range(4)]
print(sum(0<=(x-500*A-100*B)//50<=c for A in range(a+1) for B in range(b+1)))

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

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

Solution (Python):
arr = [input() for i in range(4)]
 
count = 0
for fi in range(0, int(arr[0])+1):
    for hun in range(0, int(arr[1])+1):
        for fifty in range(0, int(arr[2])+1):
            sum = fi * 500 + hun * 100 + fifty * 50
            if sum == int(arr[3]):
                count += 1
print(count)

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

count = 0
for fi in range(0, int(arr[0])+1):
    for hun in range(0, int(arr[1])+1):
        for fifty in range(0, int(arr[2])+1):
            sum = fi * 500 + hun * 100 + fifty * 50
            if sum == int(arr[3]):
                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 x == 500 * i + 100 * j + 50 * k:
                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())

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

ans=0
for i in range(a+1):
    fee=500*i
    if fee>x:
        break
    for j in range(b+1):
        fee=500*i+100*j
        if fee>x:
            break
        for k in range(c+1):
            fee=500*i+100*j+50*k
            if fee==x:
                ans+=1
            elif fee>x:
                break
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):
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())

counter = 0

for count_500 in range(coin_500 + 1):
    for count_100 in range(coin_100 + 1):
        for count_50 in range(coin_50 + 1):
            if count_500 * 500 + count_100 * 100 + count_50 * 50 == total:
                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):
import numpy as np

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


cnt=0
for i in np.arange(A+1)*500:
    for h in np.arange(B+1)*100:
        for t in np.arange(C+1)*50:
            if i+t+h==X:
                cnt+=1
                
print(cnt)

Solution (Python):

L = [int(input()) for i in range(4)]
X=L[3]
counter=0
for a in range(L[0]+1):
    for b in range(L[1]+1):
        for c in range(L[2]+1):
            if 500*a+100*b+50*c==X:
                counter+=1
print(counter)

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):
input_a = int(input())
input_b = int(input())
input_c = int(input())
input_total = int(input())
count = 0
for i in range(input_a + 1):
    for j in range(input_b + 1):
        for k in range(input_c + 1):
            if i * 500 + j * 100 + k * 50 == input_total:
                count += 1
print(count)

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

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

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

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

while x>=0 and a>=0:
  while x>=0 and b>=0:
    if x//50<=c:
      n+=1
    b-=1
    bcount+=1
    x-=100
  x+=100*bcount
  b+=bcount
  bcount=0
  a-=1
  x-=500  
print(n)

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):
    y = X - i * 500 - j * 100
    if y % 50 == 0 and 0 <= y <=50*C:
        cnt += 1
        
print(cnt)

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

workX = X

for i in range(A + 1):
    if workX > 500 * i:
        workX -= 500 * i
    elif workX == 500 * i:
        cnt += 1
        continue
    else:
        break

    for j in range(B + 1):
        if workX > 100 * j:
            workX -= 100 * j
        elif workX == 100 * j:
            cnt += 1
            break
        else:
            break

        if workX % 50 == 0 and workX <= 50 * C:
            cnt += 1
            workX += 100 * j
            continue
        else:
            workX += 100 * j

    workX = X


print(cnt)

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

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

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

print(ans)

Solution (Python):
a,b,c,x=map(int,open(0).read().split())

total=0
for a_ in range(0,a+1):
  for b_ in range(0,b+1):
    y=x-a_*500-b_*100
    if y%50==0 and 0<=y//50<=c:
      total+=1
print(total)

Solution (Python):
a,b,c,x=map(int,open(0).read().split())

total=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_+b_*100+c_*50 == x:
        total+=1
        break
print(total)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
counter=0
for i1 in range(0,a+1):
  for i2 in range(0,b+1):
    for i3 in range(0,c+1):
      if 500*i1+100*i2+50*i3==x:
        counter=counter+1
print(counter)

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

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

n = int(X/50)
num = 0

if n >= 10:
  if X%2 != 0 and C == 0:
    num == 0
  else:
    if A == 0 and B != 0:
      for c in range(C+1):
        for b in range(B+1):
          if c*50 + b*100 == X:
            num += 1
    elif A != 0 and B == 0:
      for c in range(C+1):
        for a in range(A+1):
          if c*50 + a*500 == X:
            num += 1
    else:
      for c in range(C+1):
        for b in range(B+1):
          for a in range(A+1):
            if c*50 + b*100 + a*500 == X:
              num += 1
  
elif 10 > n >= 2:
  if X%2 != 0 and C == 0:
    num == 0
  else:
    for c in range(C+1):
      for b in range(B+1):
        if c*50 + b*100 == X:
          num += 1
      
else:
  if C != 0:
    num = 1
  else:
    num = 0

print(num)

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

k=0
for i in range(min([x//500+1,a+1])):
    for j in range(min([(x-500*i)//100+1,b+1])):
        if 500*i+100*j+50*c>=x:
            k+=1

print(k)

Solution (Python):
A,B,C,X=[int(input()) for _ in range(4)]
res=0
for a in range(A, -1, -1):
  a_500 = 500 * a
  if a_500 > X:
    continue
  elif a_500 == X:
    res += 1
    continue
  else:
    for b in range(B, -1, -1):
      b_100 = 100 * b
      if a_500 + b_100 > X:
        continue
      elif a_500 + b_100 == X:
        res += 1
      else:
        for c in range(C, -1, -1):
          c_50 = 50 * c
          if a_500 + b_100 + c_50 > X:
            continue
          elif a_500 + b_100 + c_50 == X:
            res += 1
            break
          else:
            break
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())
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())
A=x//500
ans=0
for i in range(A+1):
  if(i>a):
    break
  B=(x-i*500)//100
  for j in range(B+1):
    if(j>b):
      break
    elif(0<=(x-i*500-j*100)<=50*c):
      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())
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)]
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, 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):
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())

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

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

count = 0
for a_tmp in range(a+1):
    for b_tmp in range(b+1):
        for c_tmp in range(c+1):
            total = 500*a_tmp + 100*b_tmp + 50*c_tmp
            if total == x:
                count += 1
print(count)

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

for i in range(0,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):
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):
            D = X - i * 500
            E = D - j * 100
            F = E - k * 50
            if F == 0:
                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())

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

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

list_500 = list(range(A+1))
list_100 = list(range(B+1))
list_50 = list(range(C+1))

for fh in range(len(list_500)):
    for oh in range(len(list_100)):
      for f in range(len(list_50)):
        if list_500[fh] * 500 + list_100[oh] * 100 + list_50[f] * 50 == X:
          counter += 1

print(counter)

Solution (Python):
def main():
    a, b, c, x = map(int, open(0).read().split())
    l = [
        500*x + 100*y + 50*z
        for x in range(a+1)
            for y in range(b+1)
                for z in range(c+1)
    ]
    print(l.count(x))


if __name__ == "__main__":
    main()

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

list_500 = list(range(A+1))
five_hundred_list = [n*500 for n in list_500]

list_100 = list(range(B+1))
one_hundred_list = [n*100 for n in list_100]

list_50 = list(range(C+1))
fifty_list = [n*50 for n in list_50]

for fh in range(len(five_hundred_list)):
    for oh in range(len(one_hundred_list)):
      for f in range(len(fifty_list)):
        if five_hundred_list[fh] + one_hundred_list[oh] + fifty_list[f] == X:
          counter += 1

print(counter)

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

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

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

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


if __name__ == '__main__':
    main()

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,b,c,X) = [int(input()) for _ in range(4)]
print([500*x+100*y+50*z for x in range(a+1) for y in range(b+1) for z in range(c+1)].count(X))

Solution (Python):
import sys
num50 = input().rstrip()
num10 = input().rstrip()
num5 = input().rstrip()
num = input().rstrip()

num50 = int(num50)
num10 = int(num10)
num5 = int(num5)
num = int(num)

class TestClass(object):
    cnt = 0
    def __init__(self):
        cnt = 0
    def countMoney(self, n10,n2,n1,res,flag):
        if (res == num):
            self.cnt += 1
            return
        if (n10+1 <= num50 and res+500 <= num and flag >= 500):
            self.countMoney(n10+1,n2,n1,res+500,500)
        if (n2+1 <= num10 and res+100 <= num and flag >= 100):
            self.countMoney(n10,n2+1,n1,res+100,100)
        if (n1+1 <= num5 and res+50 <= num and flag >= 50):
            self.countMoney(n10,n2,n1+1,res+50,50)

tc1 = TestClass()
tc1.countMoney(0,0,0,0,500)

print(tc1.cnt)

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

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

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

Solution (Python):
A, B, C, X = (int(input()) for _ in range(4))
L = [500 * x + 100 * y + 50 * z 
     for z in range(C + 1)
     for y in range(B + 1)
     for x in range(A + 1)
    ]
print (L.count(X))

Solution (Python):
import sys
Money_500 = int(input())
Money_100 = int(input())
Money_50  = int(input())
Amount    = int(input())
Count = 0

if Amount % 50 != 0 or Amount / 1 == 0 or Amount < 50 :
    print(Count)
    sys.exit()

for i in range(0,Money_500+1):
    if Amount < i * 500 :
        break

    for x in range(0,Money_100+1):
        if ( Amount - ( i * 500 )) - (x * 100) < 0 :
             break

        if ( Amount - (i * 500 ) - ( x * 100 )) / 50 <= Money_50 :
            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):
    I = i*500
    if X<i*500:
        break
        
    for j in range(B+1):
        J =I + j*100
        if X<J:
            break
        if X<=J + C*50:
            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):
            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())
ans = 0

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

print(ans)

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

cnt = 0
for c500 in range(l[0]+1):
  for c100 in range(l[1]+1):
    for c50 in range(l[2]+1):
      if c500 * 500 + c100 * 100 + c50 * 50 == l[3]:
        cnt += 1

print(cnt)

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

cnt = 0
for c500 in range(l[0]+1):
  sum = c500 * 500
  if sum == l[3]:
    cnt += 1
    next
  elif sum > l[3]:
    break
  else:
    for c100 in range(l[1]+1):
      sum = c500 * 500 + c100 * 100
      if sum == l[3]:
        cnt += 1
        next
      elif sum > l[3]:
        break
      else:
        for c50 in range(l[2]+1):
          sum = c500 * 500 + c100 * 100 + c50 * 50
          if sum == l[3]:
            cnt += 1
            next
          elif sum > l[3]:
            break

print(cnt)