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):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

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

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    A, B, C, X = ii(), ii(), ii(), ii()

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


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

print(count)

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

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



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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      total = 500*i + 100*j + 50*k
      if total == 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 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 = min(A, X // A) if A > 0 else 0
B = min(B, X // B) if B > 0 else 0
C = min(C, X // C) if C > 0 else 0
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):
import sys
input = sys.stdin.readline

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

ans = 0
for ia in range(A+1):
    for ib in range(B+1):
        for ic in range(C+1):
            if 500*ia+100*ib+50*ic == X:
                ans +=1
print(ans)

Solution (Python):
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

def fiveh_num(n):
    return n*500
def oneh_num(n):
    return n*100
def fif_num(n):
    return n*50

count = 0
flag_1 = 0
a = input()
b = input()
c = input()
x = input()
while flag_1==0:
    while int(a)<0 and int(a)>50 and is_integer(a):
        print('a is failed')
        a = input()
    while int(b)<0 and int(b)>50 and is_integer(b):
        print('b is failed')
        b = input()
    while int(c)<0 and int(c)>50 and is_integer(c):
        print('c is failed')
        c = input()
    if int(a)+int(c)+int(c) < 1:
        print('a or b or c is failed ')
        a = input()
        b = input()
        c = input()
    else:
        flag_1 = 1
while is_integer(x) and int(x)<50 and int(x)>20000 and int(x)%50!=0:
    print('x is failed')
    x = input()

a_num = int(a)
b_num = int(b)
c_num = int(c)
x_num = int(x)

while 1:
    if a_num*500 > x_num:
        a_num -= 1
    elif a_num*500 == x_num:
        a_num -= 1
        count += 1
    elif a_num*500 < x_num:
        while 1:
            if a_num*500 + b_num*100 > x_num:
                b_num -= 1
            elif a_num*500 + b_num*100 == x_num:
                b_num -= 1
                count += 1
            elif a_num*500 + b_num*100 < x_num:
                while 1:
                    if a_num*500 + b_num*100 + c_num*50 > x_num:
                        c_num -= 1
                    elif a_num*500 + b_num*100 + c_num*50 == x_num:
                        c_num -= 1
                        count += 1
                    elif a_num*500 + b_num*100 + c_num*50 < x_num:
                        c_num = int(c)
                        break
                b_num -= 1
            if b_num < 0:
                b_num = int(b)
                break
        a_num -= 1
    if a_num < 0:
        break

print('{}'.format(count))

Solution (Python):
a=range(int(input())+1)
b=range(int(input())+1)
c=range(int(input())+1)
x=int(input())
res=0
import itertools
p=itertools.product(a,b,c)
for i in p:
    ans =500*i[0]+100*i[1]+50*i[2]
    if ans==x:res+=1
print(res)

Solution (Python):

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

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

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

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for 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 () )
o = 0
a = A
while a >= 0:
    b = B
    while b >= 0:
        c = C
        while c >= 0:
            m = 500*a + 100*b + 50*c
            if x == m:
                o += 1
            c -= 1
        b -= 1
    a -= 1
print (o)

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

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

Solution (Python):
int_list = [int(input()) for i in range(4)]
s = 0
for i in range(int_list[0]+1):
    if int_list[3] - (500 * i) > 0:
        for j in range(int_list[1]+ 1):
            if (int_list[3] - (500 * i) ) - (100 * j) == 0:
                s += 1
            else:
                for k in range(int_list[2] + 1):
                    if  (int_list[3] - (500 * i) ) - (100 * j) - (50 * k) == 0:
                        s += 1 
                        break
                    else:
                        continue
    elif int_list[3] - (500 * i) == 0:
            s += 1
print(s)

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

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

print(res)

Solution (Python):
from itertools import product


def main():
    c500 = int(input())
    c100 = int(input())
    c50 = int(input())
    target = int(input())

    count = 0
    for n_c500, n_c100, n_c50 in product(range(c500+1), range(c100+1),  range(c50+1)):
        if (n_c500*500+n_c100*100+n_c50*50 == target): count += 1
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):
a,b,c,d = map(int, open(0))
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))

Solution (Python):

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

ans = 0

for i in range(a + 1):
    for j in range(b + 1):
        d = (x - (i * 500) - (j * 100)) // 50

        if d >= 0 and d <= c:
            ans += 1
print(ans)

Solution (Python):
A,B,C,X = map(int, open(0).read().split())

ans = 0

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

print(ans)

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 500*p+100*q+50*r==x:
        ans+=1
        
print(ans)

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

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

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

for a_value in range(a + 1):
    for b_value in range(b+1):
        for c_value in range(c+1):
            answer_values.append(a_value * 500 + b_value * 100 + c_value * 50)

print(answer_values.count(x))

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

count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C + 1):
            if 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 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):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

c = 0
for i in range(A + 1):
    if 500 * i > X:
        break
    for j in range(B + 1):
        if 500 * i + 100 * j > X:
            break
        K = X - 500 * i - 100 * j
        if K % 50 == 0:
            k = K / 50
            if k <= C:
                c += 1
print(c)

Solution (Python):
import math
def main():
  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+50*k==x:
          ans+=1
  print(ans)
  
main()

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

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 = 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, B, C, X = map(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 = 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())


if X % 100 == 50 and C == 0:
    print(0)
else:
    all_case = 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
        ]
    )

    print(all_case)

Solution (Python):
A500 = int(input())
B100 = int(input())
C50 = int(input())
X = int(input())

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

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

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
a = X // 500
b = (X - 500*a) // 100
c = (X - 500*a - 100*b) //50 

count = 0
i = a 
while i >= 0:
  j = b
  k = c
  while j >= 0:
    if i <= A and j <= B and k <= C:
      count += 1 
    j -= 1
    k += 2
  i -= 1
  b += 5
  
print(count)

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

if not (0 <= A <= 50 and 0 <= B <= 50 and 0 <= C <= 50):
    sys.exit()
if not ( 1 <= A + B + C ):
    sys.exit()
if not ( 50 <= X <= 20000 ):
    sys.exit()
if X % 50 != 0:
    sys.exit()

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










import sys

def input(): return sys.stdin.readline()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]

def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)


A = iIn()
B = iIn()
C = iIn()
X = iIn()


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):
def actual(A, B, C, X):
    count = 0

    for n_500yen in range(A + 1):
        for n_100yen in range(B + 1):
            for n_050yen in range(C + 1):
                amount = 500 * n_500yen + 100 * n_100yen + 50 * n_050yen

                if amount == X:
                    count += 1

    return count

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

print(actual(A, B, C, X))

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

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

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

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

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

cnt = 0
for i in range(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())
count=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):
                count = count+1

print(count)

Solution (Python):






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

count = 0

if X % 50 != 0:
    print(0)

else:

    Y = X // 50

    for a in range(A + 1):
        for b in range(B + 1):
            c = Y - 10 * a - 2 * b
            if 0 <= c <= C:
                count += 1

    print(count)

Solution (Python):
import itertools

a = int(input())
b = int(input())
c = int(input())
x = int(input())
y = x//50

p = 0

list_s = list(range(a+1))
list_t = list(range(b+1))
list_u = list(range(c+1))

for s,t,u in itertools.product(list_s,list_t,list_u):
    m = 10*s + 2*t + u
    if m == y:
        p += 1

print(p)

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,d = map(int,open(0))
print(sum(500*i+100*j+50*k==d 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())

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

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

count = 0


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

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
x_dash=x//50
cnt=0
for i in range(0,a+1):
  for j in range(0,b+1):
    k=x_dash-10*i-2*j
    if 0<=k<=c:
      cnt+=1
print(cnt)

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

cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 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())
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 = int(input())
b = int(input())
c = int(input())
x = int(input())
apple = [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(apple.count(x))

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=50*c
print(len([1 for i in range(a+1) for m in range(b+1) if 0<=x-500*i-100*m<=s]))

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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
sums = []
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sums.append(i*500+j*100+k*50)
print(sums.count(X))

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(int(input())//50)
count=0
for i in range(A+1):
  for j in range(B+1):
    rest=X-i*10-j*2
    if rest>=0 and rest-C<=0:
      count=count+1
print(count)

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

Solution (Python):









import sys
input = sys.stdin.readline

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

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

Solution (Python):
a,b,c = [int(input()) for i in range(3)]
x = int(input())
cnt = 0

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

print(cnt)

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

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

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

print(k)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]
res = 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:
                res += 1
print(res)

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

print(ans)

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

ans = 0

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

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

count=0

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

print(count)

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

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

print(count)

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

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

print(ans)

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

for i in range(a + 1):
  total = 0
  for j in range(b + 1):
    for k in range(c + 1):
      total = 500 * i + 100 * j + 50 * k
      if x == total:
        ans.append((i, j, k))
print(len(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):
            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 = 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())
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):
from sys import stdin
data = stdin.read().splitlines()

a = int(data[0])
b = int(data[1])
c = int(data[2])
x = int(data[3])

count = 0

l = min(x//500, a)

while l >= 0:
    x = x - 500*l
    m = min(x//100, b)
    while m >= 0:
        x = x - 100*m
        if c >= x//50:
            count += 1
        x = x + 100*m
        m -= 1
    x = x + 500*l
    l -= 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())

ct = 0

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

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

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
d=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==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 k in range(b+1):
    for u in range(c+1):
      if i*500+k*100+u*50==x:
        cnt+=1
print(cnt)

Solution (Python):
X = [int(input()) for _ in range(4)]
ans = 0
for i in range(X[0] + 1):
    for j in range(X[1] + 1):
        for k in range(X[2] + 1):
            if 500 * i + 100 * j + 50 * k == X[3]:
                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()) 

count = 0
for i in range(0,a+1):
  y = x - 500 * i
  if y < 0:
    break
  for j in range(0,b+1):
    z = y - 100 * j
    if z < 0:
      break
    elif (z / 50) <= c:
      count += 1
print(count)

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

wayCount = 0

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

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

print(cnt)

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

if __name__ == "__main__":
    main()