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())
y=0
d=0
s=0
t=0
u=0
for i in range(a+1):
    t=0
    u=0
    if s==0: 
        y=500*i
        if x < y:
            s =1
        else:
            for j in range(b+1):
                u=0
                if t==0:
                    y=500*i+100*j
                    if x < y:
                        t=1
                    else:
                        for k in range(c+1):
                            if u==0:
                                y=500*i+100*j+50*k
                                if x==y:
                                    d=d+1
                                    u=1
print(str(d))

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

A_list = list()
for i in range(A+1) :
    A_list.append(i*500)
B_list = list()
for i in range(B+1) :
    B_list.append(i*100)
C_list = list()
for i in range(C+1) :
    C_list.append(i*50)

count = 0
for a in A_list :
    for b in B_list :
        for c in C_list :
            if (a + b + c) == X :
                count += 1

print(count)

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

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

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

print(num)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


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


def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    print(solve(A, B, C, X))


if __name__ == '__main__':
    main()

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

cnt = 0

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

print(cnt)

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

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

    for j in range(b + 1): 
        if i * 500 + j * 100 == x:
            count += 1
            continue

        if 0 <= x - i * 500 - j * 100 <= 50 * c:
            count += 1

print(count)

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

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

	count = 0
	for i in range(a+1):
		y = x- 500*i
		if y == 0:
			count += 1
			continue
		if y > 0:
			for j in range(b+1):
				z = y - j*100
				if z == 0:
					count += 1
					continue
				if z > 0:
					for k in range(c+1):
						if int(z-50*k) == 0:
							count += 1
							break

	print (count)

if __name__ == "__main__":
    
    
    main()

Solution (Python):

a, b, c, x = (int(input()), int(input()), int(input()), int(input()))
factor = []
for tmp in range(a+1):
    for tmp2 in range(b+1):
        for tmp3 in range(c+1):
            if 500*tmp+100*tmp2+50*tmp3 == x:
                factor.append((tmp,tmp2,tmp3))
print(len(factor))

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

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

Solution (Python):

"""
https://beta.atcoder.jp/contests/abc087/tasks/abc087_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(A, B, C, X):
    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
    return ans


def main(args):
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    ans = solve(A, B, C, X)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[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())
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())

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

print(ans)

Solution (Python):
def solve(A, B, C, X):
    ans = 0
    for i in range(A+1):
        for j in range(B+1):
            Y = 500*i + 100*j
            if ((X-Y) % 50 == 0) and (0 <= (X-Y) / 50 <= C):
                ans += 1
    return ans
print solve(input(), input(), input(), input())

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

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

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

Solution (Python):
A,B,C,X = tuple(int(input()) for i in range(4))
ans = 0
for a in range(51):
    for b in range(51):
        c = (X - 500*a - 100*b) // 50
        if c >= 0 and a <= A and b <= B and c <= C:
            ans += 1
print(ans)

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

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

n = 0
i = 0
while i * 500 <= x and i <= a:
    if i * 500 == x:
        n += 1

    else:
        y = x - i * 500
        j = 0
        while j * 100 <= y and j <= b:
            if j * 100 == y:
                n += 1

            else:
                z = y - j * 100
                if z / 50 <= c:
                    n += 1

            j += 1
    i += 1

print n

Solution (Python):
import numpy as np

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

n = 0
i = 0
while i * 500 <= x and i <= a:
    if i * 500 == x:
        n += 1

    else:
        y = x - i * 500
        j = 0
        while j * 100 <= y and j <= b:
            if j * 100 == y:
                n += 1

            else:
                z = y - j * 100
                if z / 50 <= c:
                    n += 1

            j += 1
    i += 1

print n

Solution (Python):
n500 = int(input())
n100 = int(input())
n50 = int(input())
sum = int(input())

conb = 0
for i in range(n500 + 1):
    for j in range(n100 + 1):
        for k in range(n50 + 1):
            if 500 * i + 100 * j + 50 * k == sum:
                conb += 1
print(conb)

Solution (Python):


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

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

print str(count)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=int(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):
from sys import stdin
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
n = int(stdin.readline())
ans = 0
for i in xrange(a+1):
 for j in xrange(b+1):
  for k in xrange(c+1):
   if i * 500 + j*100 + k*50 ==n:
    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):
    if i * 500 > X:
        continue
    for j in range(B+1):
        if i * 500 + j * 100 > X:
            continue
        for k in range(C+1):
            if i * 500 + j * 100 + k * 50 > X:
                break
            elif i * 500 + j * 100 + k * 50 == X:
                count += 1

print(count)

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

count = 0

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

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

V = [500, 100, 50]

count = 0
ans = 0
def add(a, b, c):
    global ans
    count = V[0]*a + V[1]*b + V[2]*c
    if count==X:
        ans += 1
    return count

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            add(a, b, c)

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)

Solution (Python):
import sys
import math
a, b, c, x = map(int, sys.stdin.read().split("\n")[:4])
r = 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:
        r += 1
print(r)

Solution (Python):

input_lines1 = input()
int_a = int(input_lines1)
input_lines2 = input()
int_b = int(input_lines2)
input_lines3 = input()
int_c = int(input_lines3)
input_lines4 = input()
int_x = int(input_lines4)
count = 0
for i in range(int_c + 1):
    for j in range(int_b + 1):
        for h in range(int_a + 1):
            if (i * 50) + (j * 100) + (h * 500) == int_x:
                count = count + 1



print(int(count))

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

goukei=0
for a in xrange(A+1):
	tempA = a*500
	for b in xrange(B+1):
		tempB = b*100
		for c in xrange(C+1):
			if (tempA+tempB+50*c) == X:
				goukei=goukei+1
print(goukei)

Solution (Python):




def slove(a, b, c, x):
    ans = 0
    for i in range(a+1):
        for j in range(b+1):
            for k in range(c+1):
                tmp = x - 500*i - 100*j
                if tmp == 0:
                    ans += 1
                    break
                if tmp > 0 and tmp <= 50*k:
                    ans += 1
                    break

    return ans


if __name__ == "__main__":
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input())

    print(slove(a, b, c, x))

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

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

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

cnt = 0
ca = int(x/500)
if(ca>a):
    ca = a

for i in range(ca+1):
    ax = x - 500*i
    cb = int(ax/100)
    
    for j in range(cb+1):
        if(j>b):
            continue
        bx = x - 500*i - 100*j
        cc = int(bx/50)
        
        if(cc>c):
            continue
        
        cnt += 1


print(cnt)

Solution (Python):
if __name__ == '__main__':
    
    a = int(raw_input())
    b = int(raw_input())
    c = int(raw_input())
    x = int(raw_input())
    
    count = 0
    na = x / 500
    for i in range(na+1):
        nb  =   (x-i*500)/100
        for j in range(nb+1):
            nc = (x-i*500-j*100)/50
            if (i <= a) & (j <= b) & (nc <= c):
                count += 1
                
    print count

Solution (Python):
c=int(input())
b=int(input())
a=int(input())
t=int(input())
t=t//50
m=0
sum=0
while(m<=a):
	n=0
	while(n<=b):
		o=0
		while(o<=c):
			if(m+(2*n)+(10*o)==t):
				sum+=1
			o+=1
			if(m+(2*n)+(10*o)>t):
				break
		n+=1
	m+=1			
print(sum)

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):
from itertools import product

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

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

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

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

count = 0

for a in range(0, min(A + 1, X // 500 + 1)):
    for b in range(0, min(B + 1, (X - a*500)//100 + 1)):
        if ((X - a*500 - b*100) % 50) == 0 and ((X - a*500 - b*100) // 50) <= C:
            count += 1

print(count)

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

costs = [0, 0, 0]

for num_a in xrange(a + 1):
    costs[0] = num_a * 500

    for num_b in xrange(b + 1):
        costs[1] = num_b * 100

        for num_c in xrange(c + 1):
            costs[2] = num_c * 50
            if sum(costs) == 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 i*500 <= x:
        for k in range(b+1):
            if k*100 <= (x-i*500):
                if (x-i*500-k*100)/50 <= c:
                    ans += 1
print(ans)

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

print(pattern)

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):
        
        if (x - p*500 - q*100) // 50 <= c and (x - p*500 - q*100) // 50 >= 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(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 = count + 1

print(count)

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

count = 0
for k in range(a+1):
  if x-500*k < 0:
    break
  for j in range(b+1):
    if x-500*k-100*j < 0:
      break
    if (x-500*k-100*j)//50 > c:
      continue
    count += 1
print(count)

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

cnt = 0
sum = 0

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

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

cnt = 0
for adx in range(a+1):
    for bdx in range(b+1):
        for cdx in range(c+1):
            if(adx * 500 + bdx * 100 + cdx * 50 == x):
                cnt += 1

print(cnt)

Solution (Python):


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

    cnt = 0

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

    print(cnt)

Solution (Python):
coin_500 = int(input())
coin_100 = int(input())
coin_50 = int(input())
target = 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 i * 500 + j * 100 + k * 50 ==  target:
                count += 1
                

print(count)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
x = x / 50
total = a+b+c
lists = []
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:
                lists.append(b)

length = len(lists)
print(length)

Solution (Python):
A=int(input())
B=int(input())
C=int(input())
X=int(input())
x=X/50
def bcpair(y):
    count=0
    for b in range(B+1):
        if y-(2*b)>=0 and y-(2*b)<=C:
            count+=1
    return(count)
result=0
a=0
while a<=A and x-(10*a)>=0:
    result+=bcpair(x-(10*a))
    a+=1
print(result)

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

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

i = 0
p = 0
while i <= a:
    j = 0
    while j  <= b:
        k = 0
        while k <= c:
            if x == 500 * i + 100 * j + 50 * k:
                p += 1
            k += 1
        j += 1
    i += 1
print(p)

Solution (Python):





def main():
    A, B, C, X = [int(input()) for _ in [0] * 4]

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

main()

Solution (Python):
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    tt = int(input())
    total = 0

    for yen500 in range(a+1):
        for yen100 in range(b+1):
            for yen50 in range(c+1):
                if yen500 * 500 + yen100 * 100 + yen50 * 50 == tt:
                    total += 1

    print(total)

main()

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

Solution (Python):
def solve():
    a = int(input())
    b = int(input())
    c = int(input())
    x = int(input()) // 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)
solve()

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

choice_cnt = 0

for i in range(a+1):
    tmp_sum_a = i*500
    if tmp_sum_a > x:
        continue
    elif tmp_sum_a == x:
        choice_cnt += 1
        continue
    for j in range(b+1):
        tmp_sum_b = tmp_sum_a + j*100
        if tmp_sum_b > x:
            continue
        elif tmp_sum_b == x:
            choice_cnt += 1
            continue
        for k in range(c+1):
            tmp_sum_c = tmp_sum_b + k*50
            if tmp_sum_c > x:
                continue
            elif tmp_sum_c == x:
                choice_cnt += 1

print(choice_cnt)

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

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

for i in range (0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            sum.append(500*i+100*j+50*k)
print(sum.count(x))

Solution (Python):

a, b, c, x = int(input()), int(input()), int(input()), int(input())
cnt = 0
for i in range(0, a+1):
    if 500*i>x:
        break
    for j in range(0, b+1): 
        if 500*i+100*j>x:
            break
        for k in range(0, c+1):
            if 500*i+100*j+50*k>x:
                break
            elif 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())

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

Solution (Python):
gohyaku = int(input())
hyaku = int(input())
goju = int(input())
saisyu = int(input())

pattern = 0

for i in range(gohyaku+1):
    imagohya = saisyu - (i * 500)
    if imagohya == 0:
        pattern += 1
    elif imagohya > 0:
        for j in range(hyaku+1):
            imahya = imagohya - (j*100)
            if imahya == 0:
                pattern += 1
            elif imahya > 0:
                for k in range(goju+1):
                    imagoju = imahya - (k * 50)
                    if imagoju == 0:
                        pattern += 1

print(pattern)

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




count = 0

for s in range(A+1):
    for t in range(B+1):
        for u in range(C+1):
            if (500*s + 100*t + 50*u == X):

                count += 1
            else:
                pass

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

xcount=0

q=min(x/500,a)
for i in range(q+1):
   y=x-500*i
   r=min(y/100,b)
   for j in range(r+1):
      z=y-100*j
      if (z%50==0 and (z/50)<=c) :xcount=xcount+1

print xcount

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

S = [(A,B,C),]
ans = 0
while len(S) > 0:
    a, b, c = S.pop()
    s = 500*a+100*b+50*c
    if s == X:
        ans += 1
    if c > 0:
        S.append((a, b, c-1))
    elif b > 0:
        S.append((a, b-1, C))
    elif a > 0:
        S.append((a-1, B, C))
print(ans)

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

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

print(count)

Solution (Python):
from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log
from itertools import *
import string
import copy
import random
import bisect
from decimal import *
def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
 
def mp():
    return map(int,str(raw_input()).split())
a=input()
b=input()
c=input()
x=input()
a+=1
b+=1
c+=1
ans=0
for i in range(a):
	for j in range(b):
		for k in range(c):
			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())
n=0
for i in range(A+1):
    for j in range(B+1):
        if 0 <= (X-500*i-100*j)//50 <= C:
            n+=1
print(n)

Solution (Python):
a = eval(input())
b = eval(input())
c = eval(input())
x = eval(input())
count = 0
le = x // 50
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 and i * 10 + j * 2 + k <= le :
                count += 1
print(count)

Solution (Python):


def h(z,C):
  if 50*C >= z:
    return 1
  else:
    return 0

def g(y,B,C):
  ans = 0
  i = 0
  while 100*i <= y and i <= B:
    ans += h(y-100*i,C)
    i += 1
  return ans

def f(x,A,B,C):
  ans = 0
  i = 0
  while 500*i <= x and i <= A:
    ans += g(x-500*i,B,C)
    i += 1
  return ans

def solve():
  A = int(input())
  B = int(input())
  C = int(input())
  X = int(input())
  return str(f(X,A,B,C))
 
if __name__ == '__main__':
  ans = solve()
  print(ans, flush=True)

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

cache = {}

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

print d(a, b, c, x)

Solution (Python):


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


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 n in range(b+1):
        for m in range(c+1):
            if 500 * i + 100 * n + 50 * m == x:
                ans += 1
print(ans)

Solution (Python):
import collections
from pprint import pprint as pp

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

result = 0

for x500 in range(a+1):
  now_500 = 500 * x500
  if now_500 > x:
    break
  for x100 in range(b+1):
    now_100 = 100 * x100 + now_500
    if now_100 > x:
      break
    rem = (x - now_100) / 50
    if rem <= c:
      result += 1
print(result)

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

print(T)

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

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

print(K)

Solution (Python):
import numpy as np

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

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

print(num)

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

ans = 0
tmp = 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:
                ans += 1
    tmp = 0
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)