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

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

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

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

Solution (Python):
A,B,C,X = [int(input()) for _ in range(4)]
 
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):
icase=0
if icase==0:
    a=int(input())
    b=int(input())
    c=int(input())
    x=int(input())
    icnt=0
    for na in range(a+1):
        for nb in range(b+1):
            r=x-500*na-100*nb
            if 0<=r and r<=c*50 and r%50==0:
                icnt=icnt+1
    print(icnt)

Solution (Python):
import sys
input = sys.stdin.readline
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())
n=0
for i in range(A+1):
    Y=500*i
    for j in range(B+1):
        Y+=500*i+100*j
        for k in range(C+1):
            Y=500*i+100*j+50*k
            
            
            if Y==X:
                n+=1

print(n)

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

Solution (Python):
a,b,c,x=[int(input()) for _ 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
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, 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())
D = 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):
      if i*500+j*100+k*50 == D:
        ans += 1
print(ans)

Solution (Python):

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

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

print(count)

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

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

print(ans)

Solution (Python):

import io

n, m, l, h = map(int, [input() for i in range(4)])
counter = 0
for i in range(n+1):
  for j in range(m+1):
    for k in range(l+1):
      if i * 500 + j * 100 + k * 50 == h:
        counter += 1
print(counter)

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

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

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

cache = {}

def d(a, b, c, r):
    if r == 0: return 1
    if r < 0: return 0
    if cache.has_key((a, b, c, r)): return cache[(a, b, c, r)]
    s = 0
    if a > 0: s += d(a - 1, b, c, r - 500)
    if b > 0: s += d(0, b - 1, c, r - 100)
    if c > 0: s += d(0, 0, c - 1, r - 50)
    cache[(a, b, c, r)] = s
    return s

print d(a, b, c, x)

Solution (Python):
x = int(input())
y = int(input())
z = int(input())
a = int(input())
c = a/50

count = 0
for i in range(0,x+1):
    for j in range(0,y+1):
        for k in range(0,z+1):
            if(((10*i)+(2*j)+(k)) == c):
                count+=1

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
y = int(input())
 
ans = 0
 
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == y:
                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())
y = int(input())
 
ans = 0
 
for ai in range(a+1):
    for bi in range(b+1):
        for ci in range(c+1):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == y:
                ans += 1
 
print(ans)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
ans = 0
 
for xx in range(a+1):
    A = 500*xx
    for y in range(b+1) :
        B = 100*y
        for z in range(c+1):
            C = 50*z
            if x == A+B+C:
                ans += 1
            else:
                continue
 
 
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):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == x:
                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):
            amount = 500 * ai + 100 * bi + 50 * ci
            if amount == x:
                ans += 1

print(ans)

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

Solution (Python):

from itertools import product
import sys
 
 
def solve(AA: int, BB: int, CC: int, XX: int):
    print(sum(
        1
        for a, b, c in product(range(AA + 1), range(BB + 1), range(CC + 1))
        if a * 500 + b * 100 + c * 50 == XX
    ))
 
 
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    X = int(next(tokens))  
    solve(A, B, C, X)
 
 
if __name__ == '__main__':
    main()

Solution (Python):

from itertools import product
import sys


def solve(A: int, B: int, C: int, X: int):
    print(sum(
        1
        for a, b, c in product(range(A + 1), range(B + 1), range(C + 1))
        if a * 500 + b * 100 + c * 50 == X
    ))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    X = int(next(tokens))  
    solve(A, B, C, X)


if __name__ == '__main__':
    main()

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

for i in range(min(a, x//500)+1):
  for j in range(min(b, (x-500*i)//100)+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())
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())

import itertools
print(len([total for total in map(sum, itertools.product(
    [500 * i for i in range(A + 1)],
    [100 * i for i in range(B + 1)],
    [50 * i for i in range(C + 1)],
)) if total == 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):
        if (x-500*i-100*j)%50==0 and  0<=(x-500*i-100*j)/50<=c:
            cnt += 1
print(cnt)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
s=0
for i in range(A+1):
  x=X-500*i
  if x<0: break
  for t in range(B+1):
    if x<0: break
    elif 50*C>=x:
      s+=1
      x-=100
    else: x-=100
print(s)

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

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

print(ans)

Solution (Python):
from sys import stdin
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):
        r=(x-500*i-100*j)//50
        if(0<=r and r<=c):
            ans=ans+1

print(ans)

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

Solution (Python):













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

ans = 0
for en500 in range(A+1):
    for en100 in range(B+1):
        for en50 in range(C+1):
            if en500*500 + en100*100 + en50*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(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):
        ans+=1
        break
      elif (i*500+j*100+k*50>x):
        break

print(ans)

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

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



coins_number_list = [a,b,c]
buf_coins_number_list = [a,b,c]
all_patterns_list =[]



def sum_coins(coins_list):
  return coins_list[0] * 500 + coins_list[1] * 100 + coins_list[2] * 50


while(True):
  while(True):
    while(True):
      all_patterns_list.append(list(buf_coins_number_list))
      buf_coins_number_list[2] = buf_coins_number_list[2] - 1
      if buf_coins_number_list[2] < 0:
        break

    buf_coins_number_list[2] = c
    buf_coins_number_list[1] = buf_coins_number_list[1] - 1
    if buf_coins_number_list[1] < 0:
      break
  buf_coins_number_list[1] = b
  buf_coins_number_list[0] = buf_coins_number_list[0] - 1
  if buf_coins_number_list[0] < 0:
    break



all_patterns_sum_list = list(map(sum_coins, all_patterns_list))


print(all_patterns_sum_list.count(x))

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = ii()
    B = ii()
    C = ii()
    X = ii()
    print(len([1 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]))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = ii()
    B = ii()
    C = ii()
    X = ii()
    print(len([1 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]))


if __name__ == '__main__':
    main()

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

Solution (Python):
A = 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):
            x = (a*500) + (b*100) + (c*50)
            if x == 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):
import sys

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)



if '__main__' == __name__:
    resolve()

Solution (Python):

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

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

print(comb)

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

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

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

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

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

b = 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:
                b += 1
            else:
                continue

print(b)

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

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

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

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

match_count = 0
for i in range(yen500+1):
  for j in range(yen100+1):
    for k in range(yen50+1):
      if (i*500)+(j*100)+(k*50) == target:
        match_count += 1
      
print(match_count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ax = 0
for aa in range(a+1):
  for bb in range(b+1):
    for cc in range(c+1):
      if aa * 500 + bb * 100 + cc * 50 == x:
        ax += 1
print(ax)

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

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

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

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

print(cnt)

Solution (Python):
A = 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):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

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 + 50*k:
                cnt+=1
print(cnt)

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

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

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for a_500 in range(0,A+1):
    for b_100 in range(0,B+1):
        for c_50 in range(0,C+1):
            pay = 500*a_500 + 100*b_100 + 50*c_50
            if pay > 0:
                if X == pay:
                    cnt = cnt + 1
print(cnt)

Solution (Python):

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

Solution (Python):
A,B,C,X =map(int,open(0).read().split())
c=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:
        
        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):
        for k in range(c+1):
            if x == 500 * i + 100 * j + 50 * k:
                ans += 1

print(ans)

Solution (Python):

from itertools import product
import sys


def solve(A: int, B: int, C: int, X: int):
    print(sum(
        1
        for a, b, c in product(range(A + 1), range(B + 1), range(C + 1))
        if a * 500 + b * 100 + c * 50 == X
    ))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    C = int(next(tokens))  
    X = int(next(tokens))  
    solve(A, B, C, X)


if __name__ == '__main__':
    main()

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

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

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

ans = 0
a_lim = min(a, x // 500) + 1
total = x
for i in range(a_lim):
    a_total = total - 500 * i
    b_lim = min(b, a_total // 100) + 1
    for j in range(b_lim):
        b_total = a_total - 100 * j
        if b_total // 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 i * 500 + j * 100 + k * 50 == X:
                count += 1

print(count)

Solution (Python):
def append_list(num, yen):
    list = []
    while num>=0:
        list.append(num*yen)
        num-=1
    return list


y500 = int(input())
y100 = int(input())
y50 = int(input())
sum = int(input())
ans = 0

y500_list = append_list(y500, 500)
y100_list = append_list(y100, 100)
y50_list = append_list(y50, 50)

for i in y500_list:
    if i>sum:
        continue
    elif i==sum:
        ans+=1
        continue
    for j in y100_list:
        if i+j>sum:
            continue
        elif i+j==sum:
            ans+=1
            continue
        for k in y50_list:
            if i+j+k>sum:
                continue
            elif i+j+k==sum:
                ans+=1
                continue

print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
for r in range(a+1):
    for y in range(b+1):
        for z in range(c+1):
            price=500*r+100*y+z*50
            if price==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())

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

print(pattern)

Solution (Python):

import sys
input = sys.stdin.readline









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):
            if 500*ai + 100*bi + 50*ci == X:
                ans += 1

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 n in range(B+1):
		for p in range(C+1):
			sum = 500*i + 100*n + 50*p
			if sum == X:
				N = N+1
print(N)

Solution (Python):

ipt = [int(input()) for i in range(4)]

def main():
    a = ipt[0] 
    b = ipt[1] 
    c = ipt[2] 
    x = ipt[3] 

    cnt = 0;

    for ai in range(0, a + 1):
        for bi in range(0, b + 1):
            for ci in range(0, c + 1):
                if (amount(ai, bi, ci) == x):
                    cnt += 1
                    
                    
                else:
                    
                    
                    pass

    print(cnt)

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

main()

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, B, C, X = [int(input()) for x in range(4)]
cnt = 0

for a in range(A+1):
    x = X - 500*a
    if x < 0:
        break
    for b in range(B+1):
        y = x - 100*b
        if y < 0:
            break
        else:
            if y/50 <= C:
                cnt += 1
print(cnt)

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
ans = []
ans.append(min(X//500,A))
ans.append(min(X//100,B))
ans.append(min(X//50,C))
for i in range(ans[0]+1):
    for j in range(ans[1]+1):
        for k in range(ans[2]+1):
            p = i * 500 + j * 100 + k * 50
            if p == X:
                count += 1
print(count)

Solution (Python):
if __name__ == "__main__":
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    x = int(X/50)
    a = min(int(x/10),A) + 1 
    b = min(int(x/2),B) + 1 
    c = min(x,C) + 1 

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

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

print(ans)

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

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

print(counts)

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

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

ans = 0

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

Solution (Python):
import sys


lines = 4
inp = list()

for _ in range(lines):
    inp.append(sys.stdin.readline().strip())

n500 = int(inp[0])
n100 = int(inp[1])
n50 = int(inp[2])
total = int(inp[3])

pattern = 0

i = 0
while i * 500 <= total and i <= n500:
    j = 0
    while j * 100 <= total and j <= n100:
        k = 0
        while k * 50 <= total and k <= n50:
            if i * 500 + j * 100 + k * 50 == total:
                pattern += 1
            k += 1
        j += 1
    i += 1

print(pattern)

Solution (Python):
A, B, C, D = [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):
            tmp = i * 500 + j * 100 +50 *k
            if(tmp == D):
                ans += 1
print(ans)