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

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):
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):
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):
def tyoudo(a,b,c,x):
  ans=0
  for i in range(a+1):
    for ii in range(b+1):
      for iii in range(c+1):
        if x==500*i+100*ii+50*iii:
          ans+=1
  return ans
a=int(input())
b=int(input())
c=int(input())
x=int(input())
print(tyoudo(a,b,c,x))

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
num = []
for a_ in range(a+1):
    for b_ in range(b+1):
        for c_ in range(c+1):
            cal = a_ * 500 + b_ * 100 + c_ * 50
            num.append(cal)
print(num.count(x))

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

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

Solution (Python):
a,b,c,x = map(int,[input() for i in range(4)])
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if(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
A=x//500
B=x//100
for i in range(min(a+1,A+1)):
    rest=x-500*i
    for j in range(min(b+1,B+1)):
        rest1=rest-100*j
        if rest1/50<=c and rest1>=0:
            count+=1
print(count)

Solution (Python):


def check_combination(a, b, c, x):
    ans = 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:
                    ans += 1
    return ans


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

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
max_500 = min([A,X//500])
res = 0
for i in range(max_500+1):
    X_temp = X - (500*i)
    for j in range(min([B,X_temp//100])+1):
        if (X_temp - (100*j))//50 <= C:
            res += 1


print(res)

Solution (Python):
import sys
def p(s):
  sys.stderr.write(str(s)+"\n")

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

print(cnt)

Solution (Python):
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
x = int(input())
count = 0
for a in range(a_500+1):
    for b in range(b_100+1):
        c_num = int((x-a*500-b*100)/50)
        if c_num in range(c_50+1):
            count += 1
print(count)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007



def A():
    a,b = LI()
    if not (a*b)%2:
        print("Even")
    else:
        print("Odd")
    return


def B():
    s = S()
    print(s.count("1"))
    return


def C():
    n = I()
    a = LI()
    f = 0
    for j in range(100000):
        for i in range(n):
            if a[i]%2:
                f = 1
                break
            a[i] //= 2
        if f:break
    print(j)
    return


def D():
    a,b,c,x = IR(4)
    su = 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:su += 1
    print(su)
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    D()

Solution (Python):
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
x = int(input())
count = 0
for a in range(a_500+1):
    for b in range(b_100+1):
        for c in range(c_50+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())
cnt = 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:
                cnt += 1
                
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
li = [[i, j, k] 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]
print(len(li))

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())+1
B = int(input())+1
C = int(input())+1
X = int(input())
Y = []
for i in range(A):
  for j in range(B):
    for k in range(C):
      Y.append(500 *i + 100 *j + 50 *k)
print(Y.count(X))

Solution (Python):

a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    if 500*i<=x:
        for j in range(b+1):
            if 500*i+100*j<=x:
                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 d in range(0,a+1):
    for e in range(0,b+1):
        for f in range(0,c+1):
            if ((500 * d) + (100 * e) + (50 * f)) == x:
                count += 1
print(count)

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

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

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

Solution (Python):

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

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

Solution (Python):

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

_500 = 500
_100 = 100
_50 = 50

count = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if X - (a*_500 + b*_100 + c*_50) == 0:
                count = count + 1

print(count)

Solution (Python):

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

_500 = 500
_100 = 100
_50 = 50

count = 0

if A > 0:
    for a in range(A+1):
        for b in range(B+1):
            for c in range(C+1):
                if X - (a*_500 + b*_100 + c*_50) == 0:
                    count = count + 1
else:
    if B > 0:
        for b in range(B+1):
            for c in range(C+1):
                if X - (b*_100 + c*_50) == 0:
                    count = count + 1
    else:
        for c in range(C+1):
            if X - (c*_50) == 0:
                count = count + 1

print(count)

Solution (Python):
import itertools

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

available_prices = [500 * a + 100 * b + 50 * c for a, b, c in itertools.product(range(A+1), range(B+1), range(C+1))]
 
cnt = 0
for p in available_prices:
    if p == X:
        cnt += 1

print(cnt)

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

max_a = a if total // 500 > a else total // 500
max_b = b if total // 100 > b else total // 100
max_c = c if total // 50 > c else total // 50
ans = 0
for i in range(0, max_a + 1):
  for j in range(0, max_b + 1):
    for k in range(0, max_c + 1):
      sum = 500 * i + 100 * j + 50 * k
      if (sum == total) :
        ans += 1
print(ans)

Solution (Python):
num_of_500yen = int(input())
num_of_100yen = int(input())
num_of_50yen = int(input())
total = int(input())
selection = 0

for n500 in range(num_of_500yen + 1):
    for n100 in range(num_of_100yen + 1):
        for n50 in range(num_of_50yen + 1):
            tmp_total = n500 * 500 + n100 * 100 + n50 * 50
            if tmp_total == total:
                selection += 1

print(selection)

Solution (Python):
a,b,c,x=int(input()),int(input()),int(input()),int(input())
def c500(n):
  global a
  if n%500==0 and n<=500*a:return 1
  return 0
def c100(n):
  global b;ans=0
  for i in range(min(n//100,b)+1):ans+=c500(n-100*i)
  return ans
def c50(n):
  global c;ans=0
  for i in range(min(n//50,c)+1):ans+=c100(n-50*i)
  return ans
print(c50(x))

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

Solution (Python):


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


def solve(a, b, c):
    ans = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                temp = i * 500 + j * 100 + k * 50
                if temp == X:
                    ans += 1
    return ans


def main():
    ans = solve(A, B, C)
    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):
    for j in range(B+1):
        for k in range(C+1):
            temp = i * 500 + j * 100 + k * 50
            if temp == X:
                ans += 1

print(ans)

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

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


iine()

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

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

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

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

Solution (Python):
def solve(string):
    a, b, c, x = map(int, string.split())
    ans = 0
    for i in range(a + 1):
        for j in range(b + 1):
            if 0 <= x - 500 * i - 100 * j <= 50 * c:
                ans += 1
    return str(ans)


if __name__ == '__main__':
    n = 4
    print(solve('\n'.join([input() for _ in range(n)])))

Solution (Python):
def solve(string):
    a, b, c, x = map(int, string.split())
    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
    return str(ans)


if __name__ == '__main__':
    n = 4
    print(solve('\n'.join([input() for _ in range(n)])))

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


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

Solution (Python):
coins_500 = int(input())
coins_100 = int(input())
coins_50 = int(input())
X = int(input())

cnt = 0
for coin_500 in range(0, coins_500+1):
  for coin_100 in range(0, coins_100+1):
    for coin_50 in range(0, coins_50+1):
      if coin_500 * 500 + coin_100 * 100 + coin_50 * 50 == X:
        cnt +=1

print(cnt)

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

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


main()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
n = int(x/500)
if n>a:
    n = a
for i in range(n+1):
    y = x - 500*i
    m = int(y/100)
    if m>b:
        m = b
    for j in range(m+1):
        z = y - 100*j
        if z%50==0 and z/50<=c:
            count += 1
print(count)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
z=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==z:
        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):
            x =  500 * a + 100 * b + 50 * c
            if x == 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):
      
      answer += (500*a + 100*b + 50*c ==X)
print(answer)

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

result = 0

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

print(result)

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

l=0
for a in range(A+1):
    ax = X - a*500
    for b in range(B+1):
        if C*50 + b*100 >= ax and ax - b*100 >=0:
            l+=1
print(l)

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

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

Solution (Python):

a = int(input())
b = int(input())
c = int(input())
x = int(input())
X = 0
for i in range(a+1):
  temp1 = x-500*i
  if temp1 < 0:
    break
  for j in range(b+1):
    temp2 = temp1-100*j
    if temp2 < 0:
      break
    for k in range(c+1):
      temp3 = temp2-50*k
      if temp3 < 0:
        break
      if temp3 ==0:
        X += 1
  
print(X)

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):
        remain = X - 500 * i - 100 * j
        if 0 <= remain:
            if remain <= 50 * C:
                count += 1
            else:
                continue
        else:
            break

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

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

count = 0

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

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

print(cnt)

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

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

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

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

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

count = 0
for i in range(0, a + 1):
  for ii in range(0, b + 1):
    for iii in range(0, c + 1):
      sum = 500 * i + 100 * ii + 50 * iii
      if sum == x:
        count += 1

print(count)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
a=0
b=0
c=0
count = 0
while a*500<=X and a<=A:
    while a*500+b*100<=X and b<=B:
        while a*500+b*100+c * 50 <=X and c<=C:
            if a*500+b*100+c*50==X:
                
                count+=1
                break
            else:
                
                c+=1
        c=0
        b+=1
        
    a+=1
    b=0
    c=0
    
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 500*i+100*j+50*k==X:
                count = count+1
print("{}".format(count))

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

count = set()

for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if 500*ia+100*ib+50*ic == x:
                count.add(str(ia)+str(ib)+str(ic))

print(len(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())
ans = 0
for A in range(a + 1):
    for B in range(b + 1):
        C = (x - 500 * A - 100 * B) // 50
        if 0 <= C <= c:
            ans += 1
print(ans)

Solution (Python):


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


ans = 0

for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):

            ans += 1 if x == 500*ai + 100*bi + 50*ci else 0

print(ans)

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

n = 0

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

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

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

cnt = 0

for i in range (A+1):
    for p in range(B+1):
        for q in range(C+1):
            if i*500 + p*100 + q*50 == X:
                cnt += 1

print(cnt)

Solution (Python):
y500 = int(input())
y100 = int(input())
y50 = int(input())
cost = int(input())

answer = 0

for i in range (y500 + 1) :
  for p in range (y100 + 1) :
    for q in range (y50 + 1) :
      if i * 500 + p * 100 + q * 50 == cost :
        answer += 1

print(answer)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()

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

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

task1 = (x // 500) if (x // 500) < a else a
for i in range(task1 + 1):
    new_x = x - 500 * i
    task2 = (new_x // 100) if (new_x // 100) < b else b
    for i in range(task2 + 1):
        y = new_x - 100 * i
        if y <= 50 * c:
            count += 1
print(count)

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

Solution (Python):
def coins(A: int, B: int, C: int, X: int) -> int:
    count = 0
    for a in range(A + 1):
        if X < 500 * a:
            break
        for b in range(B + 1):
            c = (X - 500 * a - 100 * b) // 50

            if c < 0:
                break

            if 0 <= c and c <= C and 500 * a + 100 * b + 50 * c == X:
                count += 1

    return count


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

print(ans)

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

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


if __name__ == "__main__":
    main()

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

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

count = 0

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

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

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


print(count)

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

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

Solution (Python):
c500 = int(input())
c100 = int(input())
c50 = int(input())
t = int(input())
s = 0

for a in range(0, c500 + 1):
    for b in range(0, c100 + 1):
        for c in range(0, c50 + 1):
            if 500*a + 100*b + 50*c == t:
                s = s + 1
print(s)

Solution (Python):
a,b,c,x=eval('int(input())+1,'*4);print(sum(c>x/50-I//b*10-I%b*2>0for I in range(a*b)))

Solution (Python):
import numpy as np
import sys

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

count = 0
X_rest = 0


for i in range(A + 1):
    X_rest = X - 500 * i
    if X_rest < 0:
        print(count)
        sys.exit()
    elif X_rest == 0:
        count += 1
        continue
    for j in range(B + 1):
        X_rest = X - 500 * i
        X_rest = X_rest - 100 * j
        if X_rest == 0:
            count += 1
            
            continue

        elif X_rest >= 0 and X_rest % 50 == 0 and X_rest / 50 <= C:
            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())
pattern = 0

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

X //= 50
ans = 0
for a in range(A+1):
    tmp = 10*a
    if tmp > X:
        break
    for b in range(B+1):
        tmpB = 2*b+tmp
        if tmpB > X:
            break
        else:
            r = X-tmpB
            if r <= C:
                ans += 1
print(ans)

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

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

print(number)

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

Solution (Python):
l = [int(input()) for i in range(4)]
c = 0
for i in range(l[0]+1):
        for j in range(l[1]+1):
                for k in range(l[2]+1):
                        now = 500*i + 100*j + 50*k
                        if now == l[3]:
                                c += 1

print(c)

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