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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
x = int(input())//50
count = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 10*i+2*j+k == x: count+=1
print(count)

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

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

print(count)

Solution (Python):
a_coins = int(input())
b_coins = int(input())
c_coins = int(input())
num = int(input())

count = 0

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

Solution (Python):
five_hand = int(input())
one_hand = int(input())
fifty = int(input())
x = int(input())

count = 0

for i in range(five_hand+1):
    for j in range(one_hand+1):
        for k in range(fifty+1):
            res = 500*i + 100*j + 50*k
            if x == res:
                count += 1

print(count)

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

Solution (Python):






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

i = 0

for a in range(A+1):
    if (a * 500) == X:
        i += 1
        break

    for b in range(B+1):
        if (a * 500) + (b * 100) == X:
            i += 1
            break

        for c in range(C+1):
            if (a * 500) + (b * 100) + (c * 50)== X:
                i += 1
                break

print(i)

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

count = 0

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

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

for i in range(c+1):
    for j in range(b+1):
        if (x-50*i-100*j)%500==0 and ((x-50*i-100*j)/500)<=a and ((x-50*i-100*j)/500)>=0:
            cnt += 1

print(cnt)

Solution (Python):
import numpy as np
import sys

input = sys.stdin.readline

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

ans = 0

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

print(ans)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = INT()
B = INT()
C = INT()
X = INT()

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

print(ans)

Solution (Python):


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

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

print (count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
    for j in range(b+1):
        tmp = (x-((500*i)+(100*j)))

        if tmp == 0:
            ans += 1
        elif tmp > 0:
            if tmp%50 == 0 and tmp//50 <= c:
                ans += 1
        else:
            
            pass            
print (ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
count = 0
sum = 0
tempa = 0
tempb = 0
tempc = 0
 
while tempa <= a:
  while tempb <= b:
    while tempc <= c:
      sum = tempa * 500 + tempb * 100 + tempc * 50
      if sum == x:
        count = count + 1
      tempc = tempc + 1
    tempc = 0
    tempb = tempb + 1
  tempb = 0
  tempa = tempa + 1
 
print(count)

Solution (Python):


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

    print(cnt)


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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for cnt_500 in range(a + 1):
    for cnt_100 in range(b + 1):
        for cnt_50 in range(c + 1):
            price = 500 * cnt_500 + 100 * cnt_100 + 50 * cnt_50
            if price == x:
                cnt += 1
print(cnt)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for cnt_500 in range(a + 1):
    for cnt_100 in range(b + 1):
        for cnt_50 in range(c + 1):
            price = 500 * cnt_500 + 100 * cnt_100 + 50 * cnt_50
            if price == x:
                cnt += 1
print(cnt)

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

counter = 0
calc_x = 0

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

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

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

Solution (Python):

a = int(input())

b = int(input())

c = int(input())

x = int(input())

count = 0

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

print(count)

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

can = []

for num_A in range(A + 1):
    for num_B in range(B + 1):
        for num_C in range(C + 1):
            num = 500 * num_A + 100 * num_B + 50 * num_C
            can.append(num)

print(can.count(X))

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 = 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())
S = int(input())
Ans = 0

for i in range(A+1):
    A500 = 500 * i
    for j in range(B+1):
        B100 = 100 * j
        for k in range(C+1):
            C50 = 50 * k
            if (A500+B100+C50) == S:
                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())

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

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

cnt = 0

for a in range(int(X/500)+1):
  if a <= A:
    for b in range(int((X-a*500)/100)+1):
      if b <= B:
        if a+b+int((X-a*500-b*100)/50) >= 1 and int((X-a*500-b*100)/50) <= C:
          cnt = cnt + 1
print(cnt)

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

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

def main():

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

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

count = 0
for a in range(min([A,X//500])+1):
  for b in range(min([B,(X-500*a)//100])+1):

    if (X-500*a-100*b) % 50 == 0 and (X-500*a-100*b) / 50 <= C:

      
      count = count + 1

print(count)

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

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

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

Solution (Python):
a,b,c,x=map(int,open(0))
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 = 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)]
print([500*a+100*b+50*c for a in range(A+1) for b in range(B+1) for c in range(C+1)].count(X))

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):
        if 0<=X-500*a-100*b<=C*50:
            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())
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

print(ans)

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

rCnt = 0
ttla = 0
ttlb = 0

ia = 0

while ia <= a:
  ib = 0
  ic = 0
  ttla = 500 * ia
  ia = ia + 1
  while ib <= b:
    ic = 0
    ttlb = 100 * ib
    ib = ib + 1
    while ic <= c:
      if x == ttla + ttlb + 50 * ic:
        rCnt = rCnt + 1
      ic = ic + 1

print(rCnt)

Solution (Python):
a,b,c,x=map(int,open(0).read().split())
t=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:
        t+=1
print(t)

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

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

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

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

print(ans)

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

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

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for i in range(X//500+1):
    
    if A<i:
        break
    
    for j in range((X-500*i)//100+1):
        if B<j:
            break
        if C>=(X-(500*i)-(100*j))//50:
            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 + 50 * k == 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 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()) / 50

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

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

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    A = int(readline())
    B = int(readline())
    C = int(readline())
    X = int(readline())
    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)

if __name__ == '__main__':
    main()

Solution (Python):
A, B, C, X = map(lambda x: int(x) + 1, [input() for q in range(4)])
r = 0
for a in range(A):
    for b in range(B):
        for c in range(C):
            if (500 * a + 100 * b + 50 * c) == (X - 1):
                r += 1
print(r)

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]

DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

def main():
    a,b,c,x = [II() for _ in range(4)]
    cnt = 0
    for i in range(a+1):
        for j in range(b+1):
            k = (x-(i*500+j*100))//50
            if 0 <= k <= c: cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1, d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1, d2, d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]

DIVC = lambda x, y: -(-x//y)
DIVF = lambda x, y: x//y

def main():
    a,b,c,x = [II() 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 i*500+j*100+k*50 == x: cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()

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

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

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


def modelAnswer():
   tmp=1
def main():
   A = int(input())
   B = int(input())
   C = int(input())
   X = int(input())
   print(myAnswer(A,B,C,X))

if __name__ == '__main__':
   main()

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

num_case = 0

for i in range(A+1) :
	A_sum = 500 * i
	if A_sum > X :
		break
	for j in range(B+1) :
		AB_sum = A_sum + 100 * j
		if AB_sum > X :
			break
		for k in range(C+1) :
			ABC_sum = AB_sum + 50 * k
			if ABC_sum == X :
				num_case += 1
				break
			elif ABC_sum > X :
				break
print(num_case)

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

total=0



for i in range(0, a+1):
    if i * 500 > x_500_100_50:
        break
    
    
    x_100_50 = x_500_100_50 - i * 500

    
    for j in range(0, b+1):
        if j * 100 > x_100_50:
            break
        
        
        x_50 = x_100_50 - j * 100

        
        for k in range(0, c+1):
            if k * 50 > x_50:
                break
            if k * 50 == x_50:
                total = total + 1
                

print(total)

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

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

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

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

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

s=0

for i in range(0,min(X//500,A)+1):
  Xi=X-i*500
  for j in range(0,min(Xi//100,B)+1):
    Xj=Xi-j*100
    if Xj<= C*50:
      s=s+1

print(s)

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):
        i_j = 500*i + 100*j
        for k in range(C+1):
            if i_j + 50*k == X:
                result += 1

print(result)

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

A_list = [500*i for i in range(A+1)]
B_list = [100*i for i in range(B+1)]
C_list = [50*i for i in range(C+1)]

result = 0

for i in A_list:
    for j in B_list:
        i_j = i + j
        for k in C_list:
            if i_j + k == X:
                result += 1

print(result)

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

A_list = [500*i for i in range(A+1)]
B_list = [100*i for i in range(B+1)]
C_list = [50*i for i in range(C+1)]
sum_list = []

for i in A_list:
    for j in B_list:
        i_j = i + j
        for k in C_list:
            sum_list.append(i_j + k)

result = 0
for i in sum_list:
    if i == X:
        result += 1

print(result)

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):
            sum = 500*i + 100*j + 50*k
            if sum == X:
                ans = ans+1
                
                break
            elif sum > X:
                break

print(ans)

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

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

print(cnt)

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

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

print(ans)

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

print(count)

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

Solution (Python):
A = int(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)]
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):
import itertools

a,b,c,x=map(int,open(0).read().split())
a=[list(range(a+1)),list(range(b+1)),list(range(c+1))]
l=list(itertools.product(*a))
ans=list((a,b,c) for a,b,c in l if (a*500)+(b*100)+(c*50)==x)
print (len(ans))

Solution (Python):
A=[]
for _ in range(3):
    A.append(int(input()))
a=A[0]
b=A[1]
c=A[2]
x=int(input())
count=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                count=count+1
            else:
              count=count
print(count)

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

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):

      if i*500 + j*100 + k*50 == x:
        cnt += 1

print(cnt)

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

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

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

print(ans)

Solution (Python):
a = 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())
cnt=0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0, C+1):
            if 500*i+100*j+50*k==X:
                cnt+=1
            else:
                continue
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(input()) 
B=int(input()) 
C=int(input()) 
X=int(input())
cnt=0
for i in range(0,A+1):
    for j in range(0,B+1):
        for k in range(0, C+1):
            if 500*i+100*j+50*k==X:
                cnt+=1
            else:
                continue
print(cnt)

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

for use_500 in range(num_500 + 1):
    for use_100 in range(num_100 + 1):
        for use_50 in range(num_50 + 1):
            if use_500 * 500 + use_100 * 100 + use_50 * 50 == X:
                ans += 1

print(ans)

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

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

for i in range(0,a+1):
  for j in range(0,b+1):
    for k in range(0,c+1):
      y = i*500 + j*100 + k*50
      if x == y:
        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):
    X_a = X-a*500
    if X_a == 0:
        counter+=1
        continue
    for b in range(B+1):
        X_b = X_a - b*100
        if X_b == 0:
            counter+=1
            continue
        for c in range(C+1):
            X_c = X_b - c*50
            if X_c == 0:
                counter+=1
                continue
print(counter)