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

cnt = 0
a_min = min( x//500 ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( rem_a//100 ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0 :
            cnt+=1
            break
        if (rem_b % 50 == 0 and rem_b // 50 <= c ):
            cnt+=1
            continue
print(cnt)

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

cnt = 0
a_min = min( int(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( int(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            cnt+=1
            break
        c_min = min( int(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                cnt+=1
                break

print(cnt)

Solution (Python):
import sys

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

cnt = 0
a_min = min( int(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        cnt+=1
        break
    b_min = min( int(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            cnt+=1
            break
        c_min = min( int(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                cnt+=1
                break

print(cnt)

Solution (Python):
import sys
import math
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
a_min = min( math.floor(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    if rem_a == 0:
        counter+=1
        break
    b_min = min( math.floor(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        if rem_b == 0:
            counter+=1
            break
        c_min = min( math.floor(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            if rem_c == 0:
                counter+=1
                break
print(counter)

Solution (Python):
import sys
import math

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

counter = 0

a_min = min( math.floor(x/500) ,a)
for ai in range(a_min+1):
    rem_a = x - (ai * 500)
    
    

    if rem_a == 0:
        counter+=1
        break

    b_min = min( math.floor(rem_a/100) ,b)
    for bi in range(b_min+1):
        rem_b = rem_a - (bi * 100)
        
        

        if rem_b == 0:
            counter+=1
            break

        c_min = min( math.floor(rem_b/50) ,c)
        for ci in range(c_min+1):
            rem_c = rem_b - (ci * 50)
            
            

            if rem_c == 0:
                counter+=1
                break

print(counter)

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

sum=[]
count=0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            s=500*a+100*b+50*c
            if s==X:
                count+=1
                sum.append([a,b,c])

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for an in range(a + 1):
  for bn in range(b + 1):
    for cn in range(c + 1):
      total = an * 500 + bn * 100 + cn * 50
      if total == x:
        ans += 1
print(ans)

Solution (Python):
a = [int(input()) for i in range(4)]
count = 0

for i in range(a[0]+1) :
  for j in range(a[1]+1) :
    for k in range(a[2]+1) :
      sum = 500*i + 100*j + 50*k
      if sum == a[3] :
        count += 1
print(count)

Solution (Python):

def resolve():
    import sys
    input = sys.stdin.readline
    
    
    a = int(input().rstrip())
    b = int(input().rstrip())
    c = int(input().rstrip())
    x = int(input().rstrip())

    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)




if __name__ == "__main__":
    resolve()

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

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

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

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

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

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

Solution (Python):
coin = [500,100,50]
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i_500 in range(a+1):
    for i_100 in range(b+1):
        for i_50 in range(c+1):
            if x==i_500*500+i_100*100+i_50*50:
                ans += 1
print(ans)

Solution (Python):


from typing import Tuple
from typing import Optional
from typing import List
from enum import Enum, auto

Result = Tuple[int, int, int]


class Coin(Enum):
    COIN_500 = auto()
    COIN_100 = auto()
    COIN_50 = auto()


def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    tempResult = minResult(X)
    if tempResult is None:
        print(0)
        return

    allResultList = set(parseResult(tempResult, Coin.COIN_500))
    resultList = list(
        filter(lambda x: x[0] <= A and x[1] <= B and x[2] <= C, allResultList)
    )
    print(len(resultList))


def minResult(value: int) -> Optional[Result]:
    remain = value
    minA = value // 500
    remain -= 500 * minA
    minB = remain // 100
    remain -= 100 * minB
    minC = remain // 50
    remain -= 50 * minC

    if remain == 0:
        return minA, minB, minC
    else:
        return None


def newResult(result: Result, target: Coin) -> Result:
    a, b, c = result
    if target == Coin.COIN_500:
        return a - 1, b + 5, c
    elif target == Coin.COIN_100:
        return a, b - 1, c + 2
    elif target == Coin.COIN_50:
        return result


def parseResult(result: Result, target: Coin) -> List[Result]:
    a, b, c = result
    resultList: List[Result] = []

    if target == Coin.COIN_500:
        resultList = resultList + parseResult(result, Coin.COIN_100)
        resultList = resultList + parseResult(result, Coin.COIN_50)
        if a > 0:
            new = newResult(result, target)
            resultList = resultList + parseResult(new, Coin.COIN_500)
            resultList = resultList + parseResult(new, Coin.COIN_100)
            resultList = resultList + parseResult(new, Coin.COIN_50)
    elif target == Coin.COIN_100:
        resultList = resultList + parseResult(result, Coin.COIN_50)
        if b > 0:
            new = newResult(result, target)
            resultList = resultList + parseResult(new, Coin.COIN_100)
            resultList = resultList + parseResult(new, Coin.COIN_50)
    elif target == Coin.COIN_50:
        resultList.append(result)

    return resultList


if __name__ == "__main__":
    main()

Solution (Python):
s = [input() for i in range(4)]
coin500 = int(s[0]) 
coin100 = int(s[1])
coin50 = int(s[2])

list = []
for i in range(coin500 + 1):
  for j in range(coin100 + 1):
    for k in range(coin50 + 1):
      list.append(500 * i + 100 * j + 50 * k)

import collections
c = collections.Counter(list)
if c.get(int(s[3])) == None:
    print("0")
else:
    print(c.get(int(s[3])))

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):
abc = [int(input()) for i in range(3)]
x = int(input())

count = 0

for i in range(abc[0] + 1):
    for j in range(abc[1] +1):
        for k in range(abc[2] +1):
            if 500*i + 100*j + 50*k == x:
                count += 1
print(count)

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

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

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

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

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

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

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

print(ans)

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

count = 0

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

print(str(count))

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

count = 0

for i in range(A + 1):
    Y = X - i*500

    for j in range(B + 1):
        Z = Y - j*100
        if Z >= 0 and Z/50 <= C:
            count += 1
            

print(str(count))

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

ans = 0






















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

        if x%50 == 0 and x >=0:
            if x//50 <= C:
                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 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 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):
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)

  
if __name__ == "__main__":
  	main()

Solution (Python):
import sys
A,B,C,X=map(int,sys.stdin)

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

print(ans)

Solution (Python):
import sys
A,B,C,X=map(int,sys.stdin)

ans=0
for i in range(min(A,X//500)+1):
    ta=X-i*500
    for j in range(min(B,ta//100)+1):
        tb=ta-j*100
        if C*50>=tb:
            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):
    

    if x < (i * 500) :
        break

    for j in range(b + 1):
        

        if x < ((i * 500) + (j * 100)):
            break

        for k in range(c + 1):
            

            
            
            

            if x < (i * 500) + (j * 100) + (k * 50):
                break

            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())
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):
import sys
a,b,c,x=map(int,sys.stdin.read().split())
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
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a = ri()
b = ri()
c = ri()
x = ri()
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())

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

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

Solution (Python):
coin500, coin100, coin50, total = map(int, [int(input()) for i in range(4)])
count = 0;
for i in range(coin500 + 1):
  for j in range(coin100 + 1):
    for z in range(coin50 + 1):
      if 500 * i + 100 * j + 50 * z == total:
        count += 1
print(count)

Solution (Python):









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

l = []
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            l.append([i,j,k])


ans = 0
for i in range(len(l)):
    temp = l[i][0]*500 + l[i][1]*100 + l[i][2]*50
    if (temp == x):
        ans += 1
print(ans)

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

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())
x = 0
ans = 0
y = 0
a = [i for i in range((A + 1)* (B + 1) * (C + 1))]
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
            a[y] = x
            y += 1
ans = a.count(X)
print(ans)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
  A=500*i
  if A>x:
    break
  for j in range(b+1):
    B=100*j
    k = (x - A - B)/50
    if 0<=k<=c and k%1==0:
      ans+=1
print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
i=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:
        i = i+1
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):
        if(0 <= ((X-(500*i + 100*j))/50) <= C):
            count += 1
print(count)

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

ans = 0

for i in range(min(A, X//10) + 1):
    Y = X - 10*i
    for j in range(min(B, Y//2) + 1):
        ans += Y - 2*j <= C

print(ans)

Solution (Python):


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

possible_values = [a * 500 + b * 100 + c * 50 for a in range(A+1) for b in range(B+1) for c in range(C+1)]
is_match = [1 for i in possible_values if i == X]
print(sum(is_match))

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

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

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

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

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

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

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

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

print(count)

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

Solution (Python):
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
kadai = int(input())
sum_coins = []

for a in range(0, a_500+1, 1):
    for b in range(0, b_100+1, 1):
        for c in range(0, c_50+1, 1):
            sum_coins.append((500*a)+(100*b)+(50*c))
print(sum_coins.count(kadai))

Solution (Python):
import itertools

A = range(int(input())+1)
B = range(int(input())+1)
C = range(int(input())+1)
X = int(input())

ans = 0
for coins in itertools.product(A, B, C):
    if (coins[0]*500+coins[1]*100+coins[2]*50) == X:
        ans += 1

print(ans)

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a = inint()
b = inint()
c = inint()
x = inint()

ans = 0

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

print(ans)

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

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

Solution (Python):

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

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

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a=ni()
b=ni()
c=ni()
x=ni()

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())
an = 0
for i in range(A+1):
    for t in range(B+1):
        for u in range(C+1):
         if 500*i + 100*t + 50*u == X:
             an += 1
print(an)

Solution (Python):

A = int(input())

B = int(input())

C = int(input())

X = int(input())

res = 0
for c500 in range(A+1):
    for c100 in range(B+1):
        for c50 in range(C+1):
            total = 500*c500 + 100*c100 + 50*c50
            if ( X == total):
                res += 1

print(res)

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

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

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    A, B, C, X = map(int, read().split())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
A_str=input()
B_str=input()
C_str=input()
X_str=input()
A=int(A_str)
B=int(B_str)
C=int(C_str)
X=int(X_str)
saisho=X
tori=0
for i in range(A+1):
  X=saisho

  X=X-500*i

  if X==0:
    tori=tori+1
  elif X>0:
    saishoB=X
    for j in range(B+1):
      X=saishoB

      X=X-100*j
      if X==0:
        tori=tori+1
      elif X>0:
        saishoC=X
        for k in range(C+1):
          X=saishoC

          X=X-50*k
          if X==0:
            tori=tori+1
print(str(tori))

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
res = 0
for a500 in range(A + 1):
    for b100 in range(B + 1):
        for c50 in range(C + 1):
            if a500 * 500 + b100 * 100 + c50 * 50 == X:
                res += 1
print(res)

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

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

result = []
for a_i in range(a+1):
  for b_i in range(b+1):
    for c_i in range(c+1):
      x_tmp = x - 500 * a_i - 100 * b_i - 50 * c_i
      if x_tmp == 0:
      	result.append([a_i, b_i, c_i])
print(len(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):
            total = 500 * i + 100 * j + 50 * k
            if X == total:
                ans += 1

print(ans)

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



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

print(res)

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
ab = 0
for a_count in range(a + 1):
    for b_count in range(b + 1):
        ab = a_count * 500 + b_count * 100
        if ab <= x <= (ab + c * 50):
            ans += 1
print(ans)

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

Solution (Python):
import sys
a,b,c,x=map(int,sys.stdin.read().split())
cnt=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:
        cnt+=1

print(cnt)

Solution (Python):
m,v = {i: int(raw_input()) for i in range(3)}, {0:500,1:100,2:50}
x = int(raw_input())

def dfs(x, i, m, v):
  	if x < 0: return 0
  	if x == 0 or i == 3: 
  		return 1 if x == 0 else 0   	
  	r = 0
  	for k in range(0, m[i] + 1): r += dfs(x - k * v[i], i + 1, m, v)
  	return r
print dfs(x,0,m,v)

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

def dfs(x, i, m, v):
  	if x < 0: return 0
  	if x == 0 or i == 3: 
  		return 1 if x == 0 else 0   	
  	r = 0
  	for k in range(0, m[i] + 1): r += dfs(x - k * v[i], i + 1, m, v)
  	return r
m,v = {0:a,1:b,2:c}, {0:500,1:100,2:50}
print dfs(x,0,m,v)

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

def dfs(x, i, a, b , c):
  	if x < 0:
  		return 0
  	if x == 0:
  		return 1
  	
  	if i == 3:
  		return 1 if x == 0 else 0
  	r = 0
  	m = {0:a,1:b,2:c}
  	v = {0:500,1:100,2:50}

  	for k in range(0, m[i] + 1):
  		r += dfs(x - k * v[i], i+1, a,b,c)
  	return r

print dfs(x,0,a,b,c)

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

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

Solution (Python):

a = int(input())

b = int(input())

c = int(input())

x = int(input())

h = 0
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
            if x == y:
                h += 1
print(h)

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 h in range(C + 1):
            if i * 500 + j * 100 + h * 50 == X:
                count += 1
print(count)

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

X //= 50

res = 0

for i in range(A+1):
  rem = X-10*i
  if rem < 0:
    break
  for j in range(B+1):
    if 0 <= rem-2*j <= C:
      res += 1
      
print(res)

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