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
input=sys.stdin.readline

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+100*j+50*k==x:
				ans+=1

print(ans)

Solution (Python):
s=[int(input()) for _ in range(4)]
g=min(s[3]//500,s[0])
h=min(s[3]//100,s[1])
j=s[2]
c=0
for a in range(g+1):
	for b in range(h+1):
		x=s[3]-500*a
		x-=100*b
		if x>=0 and x//50<=s[2]:
			c+=1
print(c)

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

Solution (Python):
a, b, c, x = [int(input()) for i in range(4)]
n = 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:
        n += 1
print(n)

Solution (Python):
a,b,c,x = [int(input()) for A in range(4)]
n = 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:
                n += 1
print(n)

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


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

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

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

cnt = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 10*a + 2*b + c == X:
                cnt += 1
print(cnt)

Solution (Python):
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    a = I()
    b = I()
    c = I()
    x = I()

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


if __name__ == "__main__":
    main()

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())
b = int(input())
c = int(input())
x = int(input())

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

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



import sys



int1 = lambda x: int(x) - 1
intp1 = lambda x: int(x) + 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(yen500, yen100, yen050, objectSum):
    result = 0
    
    for yen500v in range(0, intp1(yen500)):
        for yen100v in range(0, intp1(yen100)):
            for yen050v in range(0, intp1(yen050)):
                nowtotal = yen500v*500+yen100v*100+yen050v*50
                if nowtotal == objectSum:
                    result = intp1(result)
    return result


if __name__ == "__main__":
    A = II()
    B = II()
    C = II()
    X = II()
    print("{}".format(solver(A, B, C, X)))

Solution (Python):
a,b,c,x=[int(input()) for _ in range(4)]
print(len([1 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]))

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

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

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

for i in range(a+1):
    for j in range(b+1):
        u = i*500+j*100
        if u <= x and (x-u)%50 == 0 and (x-u)//50 <= c:
            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):
      y = 500*a + 100*b + 50*c
      if X == y:
        res += 1

print(res)

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

"""
Created on Sat Mar 21 13:58:43 2020

@author: 藤原聖士
"""

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

A_count=0
B_count=0
count=0

while X-(500*A_count)>=0:
    while X-(500*A_count)-(100*B_count)>=0:
        if (X-(500*A_count)-(100*B_count))/50<=C:
            count+=1
        B_count+=1
        if B_count>B:
            break
    A_count+=1
    if A_count>A:
        break
    B_count=0

print(count)

Solution (Python):
def main(a, b, c, x):

    def gen(coin, n_of_coins, x_parts):
        for x_part in x_parts:
            for i in range(n_of_coins + 1):
                new_x_part = x_part + coin * i
                if new_x_part <= x:
                    yield new_x_part

    x_maybe_iter = gen(50, c, gen(100, b, gen(500, a, [0])))
    patterns = sum(x_maybe == x for x_maybe in x_maybe_iter)
    return patterns


if __name__ == '__main__':
    a, b, c, x = [int(input()) for _ in range(4)]
    print(main(a, b, c, x))

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

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

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

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

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

    print(correct)


if __name__ == '__main__':
    main()

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

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

    print(correct)


if __name__ == '__main__':
    main()

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

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

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):
        rem = X - 500*i - 100*j
        if rem < 0: continue
        if rem%50 == 0 and 50*(rem//50) == rem and rem//50 <= c:
            cnt += 1

print(cnt)

Solution (Python):
A, B, C, X = [int(input()) for i in range(4)]
print(sum(500*a+100*b+50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

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

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

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

count = 0

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

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

cnt=0

for i in range(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())
t=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/50:
        t+=1
print(t)

Solution (Python):

"""全探索でいける？"""
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
ans = 0
 
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == (i*500 + j*100 + k*50):
                ans += 1
 
print(ans)

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

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

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
z = int(input())
l = [500*i+100*t+50*w for i in range(a+1) 
         for t in range(b+1) for w in range(c+1)]
print(l.count(z))

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

print(count)

Solution (Python):


import sys


def solver(yen500, yen100, yen050, sumX):
    result = 0
    for j in range(0, yen500+1, +1):
        for k in range(0, yen100+1, +1):
            for m in range(0, yen050+1, +1):
                totalsum = j*500+k*100+m*50
                if sumX == totalsum:
                    result = result + 1
    return result


if __name__ == "__main__":
    A = int(sys.stdin.readline())
    B = int(sys.stdin.readline())
    C = int(sys.stdin.readline())
    X = int(sys.stdin.readline())
    
    print("{}".format(solver(A, B, C, X)))

Solution (Python):
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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


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

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A+1):
  total = 0
  for b in range(B+1):
    for c in range(C+1):
      total = 500*a + 100*b + 50*c
      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):
      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())
i1, i2, i3, p = 0, 0, 0, 0
while i1 <= a:
  while i2 <= b:
    while i3 <= c:
      m = 500 * i1 + 100 * i2 + 50 * i3
      if m > x:
        break
      elif m == x:
        p += 1
      i3 += 1
    i3 = 0
    i2 += 1
  i2 = 0
  i1 += 1
print(p)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
i1, i2, i3, p = 0, 0, 0, 0
while i1 <= a:
  while i2 <= b:
    while i3 <= c:
      m = 500 * i1 + 100 * i2 + 50 * i3
      if m == x:
        p += 1
      i3 += 1
    i3 = 0
    i2 += 1
  i2 = 0
  i1 += 1
print(p)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
i1, i2, i3 = 0, 0, 0
m1, m2, m3, p = 0, 0, 0, 0
while i1 <= a:
  m1 = 500 * i1
  while i2 <= b:
    m2 = m1 + 100 * i2
    while i3 <= c:
      m3 = m2 + 50 * i3
      if m3 < x:
        i3 += 1
        continue
      elif m3 > x:
        break
      else:
        p += 1
        break
    i3 = 0
    i2 += 1
  i2 = 0
  i1 += 1
print(p)

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

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

if __name__ == "__main__":
    main()

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

if __name__ == "__main__":
    main()

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

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

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

count = 0
result = 0

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

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

print(count)

Solution (Python):

import math


def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    cnt = 0

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

    print(cnt)


if __name__ == '__main__':
    main()

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

print(ret)

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


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

print(ret)

Solution (Python):
A, B, C, X=[int(input()) for i in range(4)]
print(sum(500*a + 100*b + 50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

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

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

print(t)

Solution (Python):
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
total = int(input())
count = 0

for i in range(coin_500 + 1):
    for j in range(coin_100 + 1):
        for k in range(coin_50 + 1):
            if 500 * i + 100 * j + 50 * k == total:
                count += 1

print(count)

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

print(np.sum(np.array(list(500*a+100*b+50*c for a in np.array(range(A+1)) for b in np.array(range(B+1)) for c in np.array(range(C+1))))==X))

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

print(count)

Solution (Python):




def solver(dataset):
    result = 0
    for yen500 in range(0, dataset[0]+1):
        for yen100 in range(0, dataset[1]+1):
            for yen050 in range(0, dataset[2]+1):
                sum = yen500*500+yen100*100+yen050*50
                if sum == dataset[3]:
                    result = result + 1
    return result


if __name__ == "__main__":
    datas = []
    for j in range(0, 4):
        datas.append(int(input()))
    print("{}".format(solver(datas)))

Solution (Python):

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())
    total = 0
    count = 0

    for a_cont in range(a+1):
        for b_cont in range(b+1):
            for c_cont in range(c+1):
                total = (a_cont*500) + (b_cont*100) + (c_cont*50)
                if total == x:
                    count = count + 1

    print(count)


if __name__ == '__main__' :
    main()

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

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

def f(a,b,c,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 += 1
  print(count)

f(A,B,C,X)

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

print(sum(500*x+100*y+50*z==X for x in range(A+1) for y in range(B+1) for z in range(C+1)))

Solution (Python):
from itertools import product

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

ans = 0

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

print(ans)

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

A, B, C, X = nin(4)

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

print(ans)

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

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

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

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

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

count = 0
for a_i in range(a + 1):
    for b_i in range(b + 1):
        for c_i in range(c + 1):
            if x == (a_i * 500 + b_i * 100 + c_i * 50):
                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(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):
y500_max = int(input())
y100_max = int(input())
y50_max = int(input())
sum = int(input())
patterns = [[ y500, y100, y50 ] for y500 in range(y500_max + 1) 
                                              for y100 in range(y100_max + 1) 
                                              for y50 in range(y50_max + 1)
                                              if y500 * 500 + y100 * 100 + y50 * 50 == sum]
print(len(patterns))

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

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

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

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

Solution (Python):
yen500,yen100,yen50,fee =  [int(input()) for i in range(4)]

counter=0
for a in range(yen500+1):
    for b in range(yen100+1):
        for c in range(yen50+1):
            total = 500 * a + 100 * b + 50 * c
            if total == fee:
                counter +=1
                break
print(counter)

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

result = 0

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

print(result)

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

Solution (Python):
A, B, C, X=[int(input()) for i in range(4)]
print(sum(500*a + 100*b + 50*c == X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

Solution (Python):
A,B,C,X=[int(input()) for i in range(4)]
print(sum(500*a+100*b+50*c==X for a in range(A+1) for b in range(B+1) for c in range(C+1)))

Solution (Python):








def resolve():
    a=int(input())
    b=int(input())
    c=int(input())
    x=int(input())

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

resolve()

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

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):
        C = int((x - 500 * i - 100 * j) / 50)
        if C >= 0 and C <= c:
            cnt += 1
            
print(cnt)

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

setc = set()
for i in range(c+1):
    setc.add(50*i)

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

print(ans)

Solution (Python):
a, b, c, x = map(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())
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,B,C,X = [int(input()) for i 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):
            total = 500 * a + 100 * b + 50 * c
            if total == X:
                ans +=1




print(ans)

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

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

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

cnt = 0

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

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

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

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

ans = [(a_i, b_i, c_i) for a_i in range(a+1) for b_i in range(b+1) for c_i in range(c+1) \
      if a_i*500+b_i*100+c_i*50==x]
print(len(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):
            sum = 500 * a + 100 * b + 50 * c
            
            if(sum == X):
                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())

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

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

print(count)