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

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

print(pattern)

Solution (Python):
a,b,c,X=[int(input()) for i in range(4)]
print([500*x+100*y+50*z for z in range(c+1) for y in range(b+1) for x in range(a+1)].count(X))

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

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

print(ans)

Solution (Python):
fiveh_num = int(input())
oneh_num = int(input())
ften_num = int(input())
sum = int(input())

count = 0

for x in range(0,fiveh_num+1):
  for y in range(0,oneh_num+1):
    for z in range(0,ften_num+1):
      ans = x*500 + y*100 + z*50
      if ans == sum:
        count += 1
      else:
        pass
print(count)

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

Solution (Python):
dbflag=""

def debug(*args):
  if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
  if ""!=dbflag:return _INDATA.readline()
  else: return input()


result = 0

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



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

print(ans)

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

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

print(count)

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

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

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

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

l = [500*i+100*j+50*k for i in range(a+1) for j in range(b+1) for k in range(c+1)]
print(l.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):
            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())

from itertools import permutations, combinations,combinations_with_replacement,product
lA = list(range(A+1))
lB = list(range(B+1))
lC = list(range(C+1))
L = product(*[lA,lB,lC]) 
cnt=0
for i in L:
  if (i[0]*500+i[1]*100+i[2]*50)==X:
    cnt+=1
print(cnt)

Solution (Python):


import numpy
import scipy

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

ok = 0
for i in range(A+1):
    m1 = X - 500*i
    if m1 >= 0:
        for j in range(B+1):
            m2 = m1 - 100*j
            if m2 >= 0:
                for k in range(C+1):
                    m3 = m2 - 50*k
                    if m3 == 0:
                        ok += 1
print(ok)

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

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

while a < A+1:
	b = 0
	while b < B+1:
		c = 0
		while c < C+1:
			if 500 * a + 100 * b + 50 * c == X:
				count += 1
			c += 1
		b += 1
	a += 1
print(count)

Solution (Python):
def check(a, b, c, x):
    test = 500 * a + 100 * b + 50 * c
    if test > x:
        return 0
    elif test == x:
        return 1
    else:
        return 0

def resolve():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    
    result = 0
    
    for i in range(a, -1, -1):
        if 500 * i > x:
            continue
        for j in range(b, -1, -1):
            if 500 * i + 100 * j > x:
                continue
            for k in range(c, -1, -1):
                if 500 * i + 100 * j + 50 * k > x:
                    continue
                result += check(i, j, k, x)
    print(result)
resolve()

Solution (Python):
def check(a, b, c, x):
    test = 500 * a + 100 * b + 50 * c
    if test > x:
        return 0
    elif test == x:
        return 1
    else:
        return 0

def resolve():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    
    result = 0
    
    for i in range(a, -1, -1):
        if 500 * i > x:
            continue
        for j in range(b, -1, -1):
            if 500 * i + 100 * j > x:
                continue
            for k in range(c, -1, -1):
                if 500 * i + 100 * j + 50 * k > x:
                    continue
                result += check(i, j, k, x)
    print(result)
resolve()

Solution (Python):
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):
        abx = X-(a*500+b*100)
        if abx < 0:break
        if abx%50==0 and abx//50 <= C:
            cnt += 1
print(cnt)

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



cnt = 0
for i1 in range(a+1):
    for i2 in range(b+1):
        for i3 in range(c+1):
            if i1 * 500 + i2 * 100 + i3 * 50 == x:
                cnt += 1
print(cnt)

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

print(ans)

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

for a in range(0,min(A+1,X//500+1)): 
    resa=X-500*a 

    for b in range(0,min(B+1,resa//100+1)): 
        resb=resa-100*b 

        if resb/50<=C: 
            
            c+=1

print(c)

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

print(s)

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

Solution (Python):

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

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

print(num)

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

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7


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

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

for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            s = ia * 500 + ib * 100 + ic * 50
            if s == x:
                cou += 1
print(cou)

Solution (Python):
def judge(A,B,C,X):
    count = 0
    for n in range(A+1):
        for l in range(B+1):
            for m in range(C+1):
                if X == 500*n+100*l+50*m:
                    count += 1
    print(count)
    
A = int(input())
B = int(input())
C = int(input())
X = int(input())
judge(A,B,C,X)

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

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

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

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

for l in range(A + 1):
    for m in range(B + 1):
        for n in range(C + 1):
            if sum(l,m,n) == X:
                result += 1

print(result)

Solution (Python):
import itertools

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

n = 0
for i,j,k in itertools.product(range(A+1),range(B+1),range(C+1)):
  if (i*500 + j*100 + k*50) == X:
  	n += 1

print(n)

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

count_combination = 0

for a_i in range(a + 1):
    for b_i in range(b + 1):
        for c_i in range(c + 1):
            sum_coins = 500 * a_i + 100 * b_i + 50 * c_i
            if sum_coins == x:
                count_combination += 1
            elif sum_coins > x:
                break
print(count_combination)

Solution (Python):
def examB():
    A = I(); B = I(); C = I(); X = I()
    ans = 0
    for i in range(min(41,A+1)):
        for j in range(B+1):
            for k in range(C+1):
                cur = 500*i + 100*j + 50*k
                if cur==X:
                    ans +=1
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Solution (Python):
A = int(input())+1
B = int(input())+1
C = int(input())+1
X = int(input())
count = 0
for x in range(A):
  for y in range(B):
    for z in range(C):
      if x*500 + y*100 + z*50 == X:
        count += 1
      else:
        pass
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(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):
from sys import stdin
from itertools import combinations
from math import factorial
import numpy as np

a = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
c = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
kai = 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:
                kai += 1

print(kai)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for p in range(a + 1) :
    for q in range(b + 1) :
        for r in range(c + 1) :
            if 500 * p + 100 * q + 50 * r == 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):
      tmp = i * 500 + j * 100 + k * 50
      if tmp == x:
        ans+=1

print(ans)

Solution (Python):

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

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

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

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

        
        
        
        
        

print(counter)

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

print(count)

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

answer = 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:
        answer += 1
      else:
        continue
print(answer)

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

cnt = 0

for num_A in [num_A for num_A in range(A + 1) if (num_A * 500 <= X)]:
    rest_XA = X - num_A * 500
    for num_B in [num_B for num_B in range(B + 1) if num_B * 100 <= rest_XA]:
        rest_XAB = rest_XA - num_B * 100
        if rest_XAB % 50 == 0 and rest_XAB <= C * 50:
            cnt += 1
print(cnt)

Solution (Python):
a5 = int(input())
b1 = int(input())
c5 = int(input())
x = int(input())
count = 0
for i in range(a5+1):
    for j in range(b1+1):
        for k in range(c5+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())

LI = []
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            y = 500*i+100*j+50*k
            LI.append(y)

counter = 0
for l in range(len((LI))):
    if LI[l] == x:
        counter += 1
    
print(counter)

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

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

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

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

Solution (Python):
l=[int(input()) for i in range(3)]
x=int(input())
ans=0
count=0
for i in range(1+l[0]):
    for j in range(1+l[1]):
        ans=x-500*i-100*j
        
        if ans>=0 and ans<=50*l[2]:
            count+=1
        
print(count)

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

Solution (Python):
def count(a, b, c, x):
    A = 10
    B = 2

    x /= 50

    count = 0
    for an in range(0, a+1):
        for bn in range(0, b+1):
            if 0 <= (x - (an * A + bn * B)) <= c:
                count += 1

    return count


a = int(input())
b = int(input())
c = int(input())
x = int(input())
print(count(a, b, c, 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 = [int(input()) for i in range(4)]

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

Solution (Python):

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

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

print(number_of_ways)

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

ans = 0

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

print(ans)

Solution (Python):


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

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

Solution (Python):
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
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    A, B, C, X = map(int, readlines())

    cnt = 0
    for i in range(A+1):
        s0 = i * 500
        if s0 > X:
            break

        for j in range(B+1):
            s1 = s0 + j * 100
            if s1 > X:
                break

            for k in range(C+1):
                s = s1 + k * 50
                if s == X:
                    cnt += 1
                elif s > X:
                    break

    print(cnt)


main()

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

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

print(ptn)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
result = 0
for num_a in range(a+1):
  for num_b in range(b+1):
    rest = x - 500*num_a - 100*num_b
    if rest >= 0 and c >= int(rest / 50):
      result += 1
print(result)

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

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

print(con)

Solution (Python):

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

A_i=min(X//500,A)+1
B_i=min(X//100,B)+1
C_i=min(X//50,C)+1

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

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

A_i=min(X//500,A)+1
B_i=min(X//100,B)+1
C_i=min(X//50,C)+1

ans=0

for i in range(0,A_i):
    for j in range(0,B_i):
        for k in range(0,C_i):
            if i*500+j*100+k*50==X:ans+=1
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

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

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

ans = 0
for _a in range(a+1):
    for _b in range(b+1):
        for _c in range(c+1):
            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())
f = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            s = 500*i + 100*j + 50*k
            if s == X:
                f+=1
print(f)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Solution (Python):


import sys








def main():
    a, b, c, x = (int(i) for i in sys.stdin.read().split())

    combination = 0
    for i in range(a+1):
        ta = 500 * i
        if ta == x:
            combination += 1
            continue
        elif ta> x:
            continue
        for j in range(b+1):
            tb = 100 * j
            if ta + tb == x:
                combination += 1
                continue
            elif ta + tb > x:
                continue
            for k in range(c+1):
                total = ta + tb + 50 * k
                if total == x:
                    combination += 1
    
    print(combination)

if __name__ == "__main__":
    
    main()

Solution (Python):
a, b, c, x=[int(input()) for i in range(4)]
print([500*X+100*Y+50*Z for X in range(a+1) for Y in range(b+1) for Z in range(c+1)].count(x))

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

for p in range(A+1):
    for q in range(B+1):
        for r in range(C+1):
            if (X - 500*p - 100*q - 50*r) == 0:
                ans += 1
                
print(ans)

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

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


ans = 0

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

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]
ans = 0
for a in range(0, A + 1):
  for b in range(0, B + 1):
    for c in range(0, C + 1):
      x = a * 500 + b * 100 + c * 50
      if X == x:
        ans += 1

print(ans)

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

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

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

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

print(pat)

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

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

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


if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    cnt = 0
    M = 0

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

    print(cnt)

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

count = 0

for l in range(0, a+1):
    for m in range(0, b+1):
        for n in range(0, c+1):
            if(500*l+100*m+50*n == 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(0,A+1):
  for b in range(0,B+1):
    if a*500+b*100>X:
      break
    if (X-a*500-b*100)//50<=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):
            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):
            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):
    ts = i * 500 + j * 100
    if x - ts >= 0 and (x - ts) % 50 == 0 and (x - ts) // 50 <= c:
      ans += 1
print(ans)

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

Solution (Python):
import numpy as np
a = int(input())
b = int(input())
c = int(input())
s = int(input())

num = 0
a_list, b_list, c_list = np.array(range(a+1)), np.array(range(b+1)), np.array(range(c+1))

for al in a_list:
    for bl in b_list:
        for cl in c_list:
            summy = 500*al + 100*bl +50*cl
            if summy==s:
                num += 1
print(num)