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

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

    ans = 0
    kmax = c * 50

    for i in range(a+1):
        I = i*500
        if I > x:
            break
        for j in range(b+1):
            IJ = I + j*100
            if IJ > x:
                break
            if x <= IJ + kmax:
                ans +=1

    print(ans)

if __name__ == '__main__':
    main()

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

    ans = 0

    for i in range(a+1):
        I = i*500
        if I > x:
            break
        for j in range(b+1):
            J = j*100
            if I+J > x:
                break
            for k in range(c+1):
                K = k*50
                if I+J+K == x:
                    ans +=1

    print(ans)

if __name__ == '__main__':
    main()

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

    ans = 0

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

    print(ans)

if __name__ == '__main__':
    main()

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

ans = 0

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

print(ans)

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

res = 0

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

Solution (Python):
def hantei(n, m, l, d ):
    if (n*500+m*100+l*50)==d:

        return True
    return False

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

n=m=l=0
result=0

while(n <= a):
    while(m <= b):
        while(l <= c):
            
            if hantei(n,m,l,d)==True:
                result += 1
            l+=1
        l=0
        
        
        m+=1
    
    
    m=l=0
    n+=1

print(result)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
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):
        rest = X-500*a-100*b
        if rest<0:
            continue
        if rest % 50 == 0 and rest // 50 <= C:
            count+=1
print(count)

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

for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if x == (500*ia + 100*ib + 50*ic):
                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):
def main():
    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):
                total = 500 * a + 100 * b + 50 * c
                if total == X:
                    cnt += 1

    print(cnt)




main()

Solution (Python):
cn500 = int(input())
cn100 = int(input())
cn50 = int(input())
g_amount = int(input())

counter = 0

for i in range(cn500+1):
    for j in range(cn100+1):
        for n in range(cn50+1):
            if g_amount == (500 * i + 100 * j + 50 * n):
                counter += 1
                break
            elif g_amount < (500 * i + 100 * j + 50 * n):
                break

print(counter)

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

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

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
input=sys.stdin.readline

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 i in range(4)]
v = 0
ans = 0

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

print(ans)

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

a = min(X//500, A)
b = min(X//100, B)
c = min(X//50, C)

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

num = 0
for i_a in range(a + 1):
  for j_b in range(b + 1):
    for k_c in range(c + 1):
      total = 500 * i_a + 100 * j_b + 50 * k_c
      if total == x:
        num += 1
print(num)

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

def calc(a,b,c):
  return 500 * a + 100 * b + 50 * c

cont = 0

for a in range(A + 1):
  for b in range(B + 1):
    for c in range(C + 1):
      if calc(a,b,c) == X:
        cont += 1

print(cont)

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

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

count = 0

for an in range(a+1):
    if 500 * an == x:
        count += 1
        break
    else:
        for bn in range(b+1):
            if 500 * an + 100 * bn == x:
                count += 1
                break
            else:
                for cn in range(c+1):
                    if 500 * an + 100 * bn + 50 * cn == x:
                        count += 1
                        break

print(count)

Solution (Python):

import math
s = 0 
a = int(input()) 
b = int(input()) 
c = int(input()) 
x = int(input()) 

while x >= 0 and a>=0 :
    s += max(0, min(b, math.floor(x/100))-max(0,math.ceil((x-50*c)/100))+1)
    a -= 1
    x -= 500
print(s)

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

count = 0
for ap in range(a+1):
	for bp in range(b+1):
		for cp in range(c+1):
			val = 500*ap + 100*bp + 50*cp
			if val == x:
				count += 1

print(count)

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

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

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

print(count)

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

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):
def coins(charge, five_hundreds, hundred, fifty):
    count = 0
    for a in range(five_hundreds + 1):
        for b in range(hundred + 1):
            for c in range(fifty + 1):
                if 500 * a + 100 * b + 50 * c == charge:
                    count += 1
    return count

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

print(coins(charge, a, b, c))

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

def countup_coin(coin_unit, coin_nums):
    ret = []
    for i in range(0, coin_nums+1):
        ret += [coin_unit * i]

    return ret


i_500 = intget()
i_100 = intget()
i_50 = intget()
expect = intget()

ptn_count = 0

coin_ptn_500 = countup_coin(500, i_500)
coin_ptn_100 = countup_coin(100, i_100)
coin_ptn_50 = countup_coin(50, i_50)

for i in coin_ptn_500:
    for j in coin_ptn_100:
        for k in coin_ptn_50:
            if (i + j + k) == expect:
                ptn_count += 1

print(ptn_count)

Solution (Python):
a,b,c,X=list(int(input()) for i 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):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 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:
                count += 1
print(count)

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

print(sum([(500 * i + 100 * j + 50 * k) == x for k in range(c + 1) for j in range(b + 1) for i in range(a + 1)]))

Solution (Python):
h500 = int(input())
h100 = int(input())
h050 = int(input())
goal = int(input())
ans = 0
i500 = 0
while i500 <= h500:
  i100 = 0
  while i100 <= h100:
    if 0 <= (goal - 500 * i500 - 100 * i100) // 50 <= h050:
      ans += 1
      
    i100 += 1
  i500 += 1
print(ans)

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

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

print(ans)

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

res = 0

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

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

count = 0

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

print(count)

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

money = x
cmp = 0

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

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

Solution (Python):
yen500 = int(input())
yen100 = int(input())
yen50 = int(input())
to = int(input())

res = 0

for i in range(yen500 + 1):
    if i * 500 > to:
        break
    for j in range(yen100 + 1):
        if 500 * i + 100 * j > to:
            break
        for k in range(yen50 + 1):
            if i*500 + j*100 + k*50 == to:
                res += 1
                break

print(res)

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

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

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

print(ans)

Solution (Python):
def combination(A, B, C, X):
    x = X/50
    
    count = 0
    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                if 10*a + 2*b + c == x:
                    count += 1
    return count
        
if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    print(combination(A, B, C, X))

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

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

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 x == 500 * ai + 100 * bi + 50 *ci:
                count += 1
print(count)

Solution (Python):
count_500 = int(input())
count_100 = int(input())
count_50 = int(input())
target = int(input())
count = 0

for num_50 in range(0, count_50 + 1):
    total = num_50 * 50
    if total == target:
        count += 1
        continue
    for num_100 in range(0, count_100 + 1):
        total_2 = num_50 * 50 + num_100 * 100
        if total_2 == target:
            count += 1
            continue
        for num_500 in range(0, count_500+1):
            total_3 = num_50 * 50 + num_100 * 100 + num_500 * 500
            if total_3 == target:
                count += 1
                continue
print(count)

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

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):
            cnt = (500*i) + (100*j) + (50*k)
            if x == cnt:
                ans += 1
                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):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

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

print(ans)

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

i=0


result=0

while i<=a:
  j=0
  while j<=b:
    k=0
    while k<=c:
     
      if i*500+j*100+k*50==x:
        result=result+1
      k=k+1
    j=j+1
  i=i+1

print(result)

Solution (Python):
a=int(input()) 
atani=500
b=int(input())
btani=100
c=int(input())
ctani=50
x=int(input())

asum=0
bsum=0
csum=0
cnt=0

for aa in range(0, a+1):
  if asum > x:
    break
  elif asum == x:
    cnt += 1
    break
    
  
  bsum=0
  for bb in range(0, b+1):
    if asum + bsum > x:
      break
    elif asum + bsum == x:
      cnt += 1
      break
      
      
    csum=0
    for cc in range(0, c+1):
      if asum + bsum + csum > x:
        break
      elif asum + bsum + csum == x:
        cnt += 1
        
        
      csum += ctani
    
    bsum += btani
  
  asum += atani

print(cnt)

Solution (Python):
import numpy as np
A = int(input())
B = int(input())
C = int(input())
X = int(input())
memo = np.zeros(3).reshape(1,3)

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 :
                result = np.array([i,j,k])
                memo = np.vstack([memo,result])

print(len(memo[1:]))

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

count = 0

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

Solution (Python):

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


pattern = 0


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

print(pattern)

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

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[0]*4];print(sum([(i)*10+(j)*2+(k)*1==x/50 for i in range(a+1)for j in range(b+1)for k in range(c+1)]))

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

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

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

A_max = int(X / 500) if int(X / 500) <= A else A
B_max = 0
C_max = 0
X_tmp_a = X
X_tmp_b = X
count = 0

for a in range(A_max + 1):
    X_tmp_a = X - 500 * a
    B_max = int(X_tmp_a / 100) if int(X_tmp_a / 100) <= B else B
    for b in range(B_max + 1):
        X_tmp_b = X_tmp_a - 100 * b
        if int(X_tmp_b / 50) <= C:
            C_max = int(X_tmp_b / 50)
            count += 1

print(count)

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

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

print(len([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):
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())

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

print(answer)

Solution (Python):
import sys

c500, c100, c50, x = [int(v) for v in sys.stdin.read().splitlines()]
count = 0
for i in range(c500+1):
  for j in range(c100+1):
    for k in range(c50+1):
      if 500 * i + 100 * j + 50 * k == x:
        count += 1
print(count)

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

count = 0
for num_x in range(int(x/10) + 1):
    if num_x > a:
        break
    x1 = x - 10*num_x
    for num_ii in range(int(x1/2) + 1):
        if num_ii > b:
            break
        num_i = x1 - 2*num_ii
        if num_i <= c:
            count += 1

print(count)

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

res = 0

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

print(res)

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

maxA = X // 500 if 500 * A > X else A
for i in range(maxA + 1):
  maxB = (X - 500 * i) // 100 if 100 * B > (X - 500 * i) else B
  for j in range(maxB + 1):
    q,mod = divmod (X - 500 * i - 100 * j ,50)
    if mod == 0 and q <= C:count += 1    
print(count)

Solution (Python):
def solve():
    a, b, c, x = read()
    result = think(a, b, c, x)
    write(result)


def read():
    a = read_int(1)[0]
    b = read_int(1)[0]
    c = read_int(1)[0]
    x = read_int(1)[0]
    return a, b, c, x


def read_int(n):
    return list(map(int, read_line().split()[:n]))


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(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


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Solution (Python):
def 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):
                total = 500 * a + 100 * b + 50 * c
                if total == X:
                    result += 1

    print(result)


if __name__ == '__main__':
    main()

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

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

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(raw_input())
B = int(raw_input())
C = int(raw_input())
X = int(raw_input())

cnt = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = int(500 * i + 100 * j + 50 * k)
            if int(sum) == int(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):
      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())

cnt = 0
for i in range(0, A+1):
        for j in range(0, B+1):
                for k in range(0, C+1):
                        if int(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())

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

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

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

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

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

        
print(counter)

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

comb = 0

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

Solution (Python):
num_500 = int(input())
num_100 = int(input())
num_50 = int(input())
target = int(input())
count = 0
for i in range(0,num_500+1,1):
    if(500*i > target):
        break
    for j in range(0,num_100+1,1):
        if(500*i+100*j>target):
            break
        for k in range(0,num_50+1,1):
            if(500*i+100*j+50*k > target):
                break
            if(500*i+100*j+50*k == target):
                count += 1
                break
print(count)

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

count = 0

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

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
                total = i*500 + j*100 + k*50
                if total == 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):
max_n500 = int(input())
max_n100 = int(input())
max_n50 = int(input())
target_amount = int(input())

count = 0
for n500 in range(max_n500 + 1):
    amount_500 = n500 * 500
    if amount_500 > target_amount:
        break
    for n100 in range(max_n100 + 1):
        amount_100 = n100 * 100
        amount_500_100 = amount_500 + amount_100
        if amount_500_100 > target_amount:
            break
        for n50 in range(max_n50 + 1):
            amount_50 = n50 * 50
            current_amount = amount_500_100 + amount_50
            if current_amount == target_amount:
                count += 1
print(count)

Solution (Python):
max_n500 = int(input())
max_n100 = int(input())
max_n50 = int(input())
amount = int(input())

count = 0
for n500 in range(max_n500 + 1):
    for n100 in range(max_n100 + 1):
        for n50 in range(max_n50 + 1):
            if n500 * 500 + n100 * 100 + n50 * 50 == amount:
                count += 1
print(count)

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

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

print(z)

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

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

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

    print(count)

main()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            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)