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

for l in range(a + 1):
    for m in range(b + 1):
        for n in range(c + 1):
            s = 500 * l + 100 * m + 50 * n
            if s == 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):
    ayen=i*500
    if ayen<=x:
        for j in range(b+1):
            byen=j*100
            if ayen+byen<=x:
                extra=x-ayen-byen
                if extra<=c*50:
                    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 i*500 +j*100+k*50 ==x:
                    count+=1
    print(count)

Solution (Python):
a, b, c, x = int(input()), int(input()), int(input()), int(input())
count = 0
for i in range(a + 1):
  p = x - i * 500
  if p < 0 :
    continue
  elif p == 0:
    count += 1
    continue
  for j in range(b + 1):
    q = p - j * 100
    if q < 0 :
      continue
    elif q == 0:
      count += 1
      continue
    for k in range(c + 1):      
      if q - k * 50 == 0 :
        count += 1
      else:
        continue
      
print(count)

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

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

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

a = list(range(0,A+1))
b = list(range(0,B+1))
c = list(range(0,C+1))

fifty = X/50
ans = 0

for i in itertools.product(a, b, c):
    if 10*i[0]+2*i[1]+i[2] == fifty:
        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 X == 500*i + 100*j + 50*k:
                count += 1

print(count)

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

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

print(ans)

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

Solution (Python):
import itertools

def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    a = [x for x in range(A+1)]
    b = [x for x in range(B+1)]
    c = [x for x in range(C+1)]
    ans = 0
    for i,j,k in itertools.product(a,b,c):
        if X == 500*i + 100*j + 50*k:
            ans += 1
    print(ans)

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

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

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

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

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

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

n = 0
for an in range(a+1):
    for bn in range(b+1):
        for cn in range(c+1):
            if 500 * an + 100 * bn + 50 * cn == x:
                n += 1
print(n)

Solution (Python):
"""
B - Coins
"""

kaisu = 0


a = int(input())


b = int(input())


c = int(input())


x = int(input())




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

print(kaisu)

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

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

count = 0

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

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
p = 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:
                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):
    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 i_500 in range(a + 1):
  for i_100 in range(b + 1):
    for i_50 in range(c + 1):
      sum = 500 * i_500 + 100 * i_100  + 50 * i_50
      if sum == x:
        count += 1

print(count)

Solution (Python):


import sys
input=sys.stdin.readline

def main():
    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):
            if 0<=X//50-10*i-2*j<=C:
                cnt+=1
    print(cnt)
    
if __name__=="__main__":
    main()

Solution (Python):
import math
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)]

"""
aが500円
bが100円
cが50円
"""
flag = 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:
                flag += 1
print(flag)

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

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

amount = int(input())

count = 0
for i in range(a+1):
    for j in range(b+1):
        temp = amount - (500*i + 100*j)
        
        if temp < 0:
            continue
        elif temp%50!=0:
            continue
        elif c < temp//50:
            continue
        
        count+=1
print(count)

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

Solution (Python):
import numpy as np










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

gohyaku=(np.arange(0,500*A+1,500)).reshape(1,-1)
hyaku=(np.arange(0,100*B+1,100)).reshape(1,-1)
goju=(np.arange(0,50*C+1,50)).reshape(1,-1)


gohyaku1=X-(gohyaku+hyaku.T)
count=0
for i in range(A+1):
    for k in range(B+1):
        if 0 <= gohyaku1[k,i] <= C*50:
            count=count+1

print(count)

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


m=x//50
count=0


for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if 10*i+2*j+k==m:
                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 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,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, b, c, x = [int(input()) for _ in range(4)]
cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            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())
out=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = i*500 + j*100 + k*50
            if sum==X:
                out+=1
print(out)

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 = cnt + 1

print(cnt)

Solution (Python):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


A = I()
B = I()
C = I()
X = I()
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())

    money = 0
    ans = 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:
                    
                    ans += 1

    print(ans)

if __name__ == "__main__":
    main()

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

import itertools as it
ans = 0
for a,b,c in it.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, 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 500*a + 100*b + 50*c == x:
        count += 1
print(count)

Solution (Python):
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a = int(input())
b = int(input())
c = int(input())
x = int(input())
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, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a = int(input())
b = int(input())
c = int(input())
x = int(input())
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):
n =[]

for _ in range(4):
  n += map(int, input().split())

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

Solution (Python):
import sys
input = sys.stdin.readline
import math


def read():
    A = int(input().strip())
    B = int(input().strip())
    C = int(input().strip())
    X = int(input().strip())
    return A, B, C, X

def solve(A, B, C, X, XMAX=20001):
    dp = [[0 for j in range(XMAX)] for i in range(4)]
    dp[0][0] = 1
    for i, (v, c) in enumerate(zip([500, 100, 50], [A, B, C])):
        for x in range(XMAX):
            for j in range(c+1):
                if x - j * v >= 0:
                    dp[i+1][x] += dp[i][x - j * v]
    return dp[3][X]


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

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

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



import os
import sys







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

    result = 0

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


if __name__ == '__main__':
    main()

Solution (Python):



import os
import sys







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

    result = 0

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


if __name__ == '__main__':
    main()

Solution (Python):

coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())

target = int(input())

counter = 0


for i_500 in range(coin_500 + 1):
    
    if i_500 * 500 > target:
        break

    for i_100 in range(coin_100 + 1):
        
        if i_500 * 500 + i_100 * 100 > target:
            break

        for i_50 in range(coin_50 + 1):
            
            if i_500 * 500 + i_100 * 100 + i_50 * 50 == target:
                
                counter += 1

print(counter)

Solution (Python):
def resolve():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = []
    for a in range(A + 1):
        for b in range(B + 1):
            c = (X - 500 * a - 100 * b) / 50
            if c <= C and c >= 0:
                ans.append((a, b, c))

    print((len(set(ans))))

    return

resolve()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
su = int(input())
su_store = su
cnt =0
cnt4 =0
for a_ in range(a+1):
  if cnt4 ==0:
    su = su_store
    su -= 500*a_
   
    if su ==0:
      cnt +=1
      cnt4 +=1
    if su >0:
      cnt3 =0
      for b_ in range(b+1):      
        if cnt3 ==0:
          su -=100*b_
          if su ==0:
            cnt +=1
           
            cnt3 +=1
          if su >0:
            cnt2 = 0
            for c_ in range(c+1):
              if cnt2 ==0:
                su -=50*c_
                
                if su ==0:
                  cnt +=1
                  cnt2 +=1
                su +=50*c_
          su +=100*b_
print(cnt)

Solution (Python):
five = int(input()) + 1
hand = int(input()) + 1
fives = int(input()) + 1
ans = int(input()) 
tmp = 0
 
for i in range(five):
  for j in range(hand):
    for k in range(fives):
      ask = 500 * i + 100 * j + 50 * k
      if ans == ask:
        tmp = tmp + 1

print(tmp)

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

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):
        nomore = False
        for k in range(c+1):
            s = 500*i + 100*j + 50*k
            if s == x:
                ans += 1
            elif s > x:
                break
print(ans)

Solution (Python):


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


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

Solution (Python):
import sys
input = sys.stdin.readline

coin_count = [int(input()) for _ in range(3)]
X = int(input())

result = 0
for i in range(min(X//500, coin_count[0]) + 1):
    for j in range(min((X - 500*i)//100, coin_count[1]) + 1):
        if 500 * i + 100 * j + 50 * coin_count[2] >= X:
            result += 1
print(result)

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = i()
b = i()
c = i()
x = i()

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

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

def cal(p,q,r):
  s=500*p+100*q+50*r
  return s

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      d=cal(i,j,k)
      if(d==x):
        ctr+=1

print(ctr)

Solution (Python):






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





ans = 0
for a in range(min(X//500+1, A+1)):
    for b in range(min((X-500*a)//100+1, B+1)):
        c = (X-500*a-100*b)//50

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

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

count = 0

i = 0
while i <= coin500:
    j = 0
    while j <= coin100:
        k = 0
        while k <= coin50:
            if i * 500 + j * 100 + k * 50 == price:
                count += 1
            k += 1
        j += 1
    i += 1

print(count)

Solution (Python):
import math
from collections import deque
from collections import defaultdict

import bisect


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	
	ans = data[:]
	return ans

def isInt(n):
	if isinstance(n, int):
		return True
	else:
		return n.is_integer()

a = readInt()
b = readInt()
c = readInt()
x = readInt()

ans = 0

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

ans = 0
for ai in range(A+1):
  for bi in range(B+1):
    for ci in range(C+1):
      if 10*ai + 2*bi + ci == X:
        ans += 1
        
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
xdvd = int(input())
res = 0
for al in range(a + 1):
  for be in range(b + 1):
    for ga in range(c + 1):
      if 500 * al + 100 * be + 50 * ga == xdvd:
        res += 1
print(res)

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

ans = 0

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

print(ans)

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())/50
ans=0
for i in range(0,a+1):
  for j in range(0,b+1):
    for k in range(0,c+1):
      if x==10*i+2*j+k:
        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):
            Yen = 500 * a + 100 * b + 50 * c
            if (X == Yen):
                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 x == 500*i+100*j+50*k: count+= 1

print(count)

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

    xa = 500
    xb = 100
    xc = 50

    Count = 0

    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
              if (xa * i + xb * j + xc * k) == X:
                  Count += 1
    print(Count)

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

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

Solution (Python):
def main():
    coin_a = int(input())
    coin_b = int(input())
    coin_c = int(input())
    total_money = int(input())
    result_count = 0

    for i in range(coin_a+1):
        for j in range(coin_b+1):
            for k in range(coin_c+1):
                if i * 500 + j * 100 + k * 50 == total_money:
                    result_count += 1

    print(result_count)


if __name__ == '__main__':
    main()

Solution (Python):
def check_money(a, b, c, total, results):
    if a * 500 + b * 100 + c * 50 == total:
        check = str(a) + ',' + str(b) + ',' + str(c)
        for result in results:
            if check in result:
                break
        else:
            results.append(check)
        return results
    else:
        return results


def main():
    coin_a = int(input())
    coin_b = int(input())
    coin_c = int(input())
    total_money = int(input())
    result = list()

    for coin_a_count in range(coin_a+1):
        if coin_a_count <= coin_a:
            for coin_b_count in range(coin_b+1):
                if coin_b_count <= coin_b:
                    for coin_c_count in range(coin_c+1):
                        if coin_c_count <= coin_c:
                            result = check_money(coin_a_count, coin_b_count, coin_c_count, total_money, result)

    print(result.__len__())


if __name__ == '__main__':
    main()