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):
a1 = int(input())
b1 = int(input())
c1 = int(input())
x1 = int(input())

co = 0
for a2 in range(0,a1+1):
    for b2 in range(0,b1+1):
        for c2 in range(0,c1+1):
            if a2*500 + b2*100 + 50 *c2 == x1:
                co += 1
print(co)

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

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

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


x=X/50

count=0

for i in range(a+1):
  for l in range(b+1):
    if 0<=x-i*10-l*2<=c:
      count+=1
      
print(count)

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

main()

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

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

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

print(count)

Solution (Python):
def pay500():
    a_max = min(int(x / 500), a)

    return [x - 500 * i for i in range(a_max + 1)]


def pay100(pay: int):
    b_max = min(int(pay / 100), b)
    return [pay - i * 100 for i in range(b_max + 1)]


def pay50(pay_list: list):
    def canPay(pay: int):
        if 50 * c >= pay:
            return True
        else:
            return False

    return list(map(canPay, pay_list))


def judge():
    def countTrue(l: list, count: int, remain: int):
        count += l[remain].count(True)
        if remain > 0:
            countTrue(l, count, remain - 1)
        else:
            print(count)

    a_list = pay500()
    b_list = list(map(pay100, a_list))
    c_list = list(map(pay50, b_list))
    c_len = len(c_list)

    countTrue(c_list, 0, c_len - 1)


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

judge()

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
z = 0
number = 0
for i in range(a+1):
    for g in range(b+1):
        for h in range(c+1):
            z = 500*i + 100*g + 50*h
            if x == z:
                number += 1

print(number)

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

Solution (Python):
n_500 = int(input())
n_100 = int(input())
n_50 = int(input())
price = int(input())
count = 0

for i in range(n_500+1):
    for j in range(n_100+1):
        for k in range(n_50+1):
            if(price ==500*i+100*j+50*k):
                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 500 * a + 100 * b + 50 * c == X:
        count += 1

print(count)

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

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

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 ai in range(A+1):
    for bi in range(B+1):
        for ci in range(C+1):
            if 500*ai + 100*bi + 50*ci == 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):
    q = (X - (a * 500 + b * 100)) / 50
    if q >= 0 and q <= C:
        ans += 1
print(ans)

Solution (Python):
A,B,C,x = [int(input()) for _ in range(4)]
cnt = 0
for a in range(A+1):
  for b in range(B+1):
    if 0<=(x-500*a-100*b)//50<=C:
      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 l in range(b + 1):
    for n in range(c + 1):
      tmp = (500 * i) + (100 * l) + (50 * n)
      if tmp == x:
        ans += 1
        
print(ans)

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

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

res = int(0)

for x in range(A+1):
	for y in range(B+1):
		for z in range(C+1):
			total = int(500*x + 100*y + 50*z)
			if(total == X):
				res+=1
			
print(res)

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

count = 0

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

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


count = 0

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

print(count)

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

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

print(ans)

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

Solution (Python):
v500 = int(input())
v100 = int(input())
v50 = int(input())
sum = int(input())
count = 0
for i500 in range(v500 + 1):
    if 500 * (v500 - i500) <= sum:
        rest_500 = sum - 500 * (v500 - i500)
        for i100 in range(v100 + 1):
            if 100 * (v100 - i100) <= rest_500:
                rest_100 = rest_500 - 100 * (v100 - i100)
                for i50 in range(v50 + 1):
                    if 50 * (v50 - i50) == rest_100:
                        count += 1
print(count)

Solution (Python):

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

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

Solution (Python):
A,B,C,X = [int(s) for s in open(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):

A,B,C,X =[int(s) for s in open(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):
A = int(input()) 
B = int(input()) 
C = int(input()) 
x = int(input())
sum = 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:
        sum += 1
print(sum)

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

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

ans=0

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

print(ans)

Solution (Python):

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










count = 0


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



print(count)

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

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            temp = 500*i + 100*j + 50*k
            temp_list.append(temp)

ans = [n==x for n in temp_list].count(True)
print(ans)

Solution (Python):
y500 = int(input())
y100 = int(input())
y50 = int(input())
ysum = int(input())
count = 0

for a in range(y500+1):
  for b in range(y100+1):
    for c in range(y50+1):
      if ysum == 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):
      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 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 c in range(0,C+1):
	if c*50 > X :
		break
	for b in range(0,B+1):
		if c*50+b*100 > X:
			break
		for a in range(0,A+1):
			if a*500+b*100+c*50 > X:
				break
			if a*500+b*100+c*50 == X:
				count += 1
print(count)

Solution (Python):
A_having = int(input())
B_having = int(input())
C_having = int(input())
X = int(input())

patterns = 0
for a in range(A_having + 1):
    for b in range(B_having + 1):
        for c in range(C_having + 1):
            total = a * 500 + b * 100 + c * 50
            if total == X:
                patterns += 1

print(patterns)

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):
      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())
print(len([1 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]))

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

ans = 0

Bmax = B * 100
Cmax = C * 50

for a in range(A+1):
    b = 0
    rest = X - 500 * a
    if rest < 0:
        break
    if rest > Bmax + Cmax:
        continue
    if rest == 0:
        ans += 1
        
        continue
    else: 
        for b in range(B+1):
            rest = X - 500 * a - 100 * b
            if rest < 0:
                break
            if rest > Cmax:
                continue
            else: 
                ans += 1
                

print(ans)

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

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

print(counter)

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

count = 0
for i in range(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())
ans = 0

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

Solution (Python):
aa=int(input())
bb=int(input())
cc=int(input())
xx=int(input())

counter=0

for a in range(aa+1):
	for b in range(bb+1):
		for c in range(cc+1):
			x=500*a+100*b+50*c
			if x==xx:
				counter+=1

print(counter)

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

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

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

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

print(count)

Solution (Python):



a, b, c, x = map(int, [input() for i in range(4)])
ans = 0

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

print(ans)

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

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

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

for i in range(int(X/500) + 1 ):
    if i > A :continue
    remain_100 = X - 500 * i

    for j in range(int(remain_100/100) + 1):
        if j > B :continue
        remain_50 = remain_100 - (100 * j)

        if int(remain_50/50) > C:continue
        counter += 1

print(counter)

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

print(result)

Solution (Python):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for ac in range(a + 1):
    for bc in range(b + 1):
        for cc in range(c + 1):
            if ac * 500 + bc * 100 + cc * 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):
    total=500*i
    if total>x:
        break
    for j in range(b+1):
        total+=100*j
        if total>x:
            break
        if (x-total)%50==0 and (x-total)/50<=c:
            ans+=1
        total=500*i
    total=0
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 500*a+100*b+50*c==X:
        count+=1
print(count)

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

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

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

Solution (Python):
a_num = int(input())
b_num = int(input())
c_num = int(input())
x = int(input())

count = 0

for a in range(a_num + 1):
	a *= 500
	if a == x:
		count += 1
		continue
    
	for b in range(b_num + 1):
		b *= 100
		if (a + b) == x:
			count+=1
			continue
      
		for c in range(c_num + 1):
			c *= 50
			if (a + b + c) == x:
				count+=1
				continue

print(count)

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

ans=0

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

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

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

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

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

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

"""
A = 10C → C = 0.1A
B = 2C → C = 0.5B
"""
counter = 0

for a in range(A+1):
    tmpa = X - 500*a
    for b in range(B+1):
        tmpb = tmpa - 100*b
        for c in range(C+1):
            tmpc = tmpb - 50*c
            if tmpc == 0:
                counter += 1
                

print(counter)

Solution (Python):


import math

l = []
for _ in range(4):
  l.append(int(input()))

a, b, c, x = l

a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )

sum, cnt = [0] * 2  
for i in range(a_c + 1):
  sum = x - 500 * i
  if sum == 0:
    cnt += 1
  if sum <= 0:
    break
  for j in range(b_c + 1):
    sum = x - 500 * i - 100 * j
    if sum == 0:
      cnt += 1
    if sum <= 0:
      break
    for k in range(c_c + 1):
      sum = x - 500 * i - 100 * j - 50 * k
      if sum == 0:
        cnt += 1
      if sum <= 0:
        break
print(cnt)

Solution (Python):


import math

l = []
for _ in range(4):
  l.append(int(input()))

a, b, c, x = l

a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )
b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )
c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )

i, j, k, sum, cnt = [0] * 5  
while (i <= a_c):
  sum = x - 500 * i
  if sum < 0:
    break
  if sum == 0:
    cnt += 1

  else:
    while (j <= b_c):
      sum = x - 500 * i - 100 * j
      if sum < 0:
        break
      if sum == 0:
        cnt += 1

      else:
        while (k <= c_c):
          sum = x - 500 * i - 100 * j - 50 * k
          if sum < 0:
            break
          if sum == 0:
            cnt += 1
          k += 1
        k = 0

      j += 1
    j = 0

  i += 1

print(cnt)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(min(A,X//500)+1):
    for j in range(min(B,X//100)+1):
        y = X-500*i-100*j
        if y<0:break
        if y//50<=C:
            cnt += 1
print(cnt)

Solution (Python):
li = []
for i in range(3):
    li.append(int(input()))
X = int(input())

ans = 0

for i in range(li[0]+1):
    for j in range(li[1]+1):
        for k in range(li[2]+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())
kotae = 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:
        kotae += 1
print(kotae)

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

req_500 = X//500
max_500 = min(req_500, A)

for i in range(0, max_500+1):
	X_sub500 = X - 500*i
	req_100 = X_sub500//100
	max_100 = min(req_100, B)
		
	for j in range(0, max_100+1):
		X_sub100 = X_sub500 - 100*j
		req_50 = X_sub100//50
		if req_50 <= C:
			count += 1

print(count)

Solution (Python):
import sys
from functools import reduce
import copy
import math
from pprint import pprint


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    A500 = int(inputs[0])
    B100 = int(inputs[1])
    C50 = int(inputs[2])
    X = int(inputs[3])

    count = 0
    for a in range(A500 + 1):
        for b in range(B100 + 1):
            for c in range(C50 + 1):
                m = a * 500 + b * 100 + c * 50
                if m == X:
                    count += 1
    return count


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(4))
    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 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):
    a = 500 * i
    for j in range(B+1):
        b = 100 * j
        for k in range(C+1):
            c = 50 * k
            if a + b + 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
                break
print(ans)

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

ans = [True 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(sum(ans))

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    a = int(input().rstrip('\n'))
    b = int(input().rstrip('\n'))
    c = int(input().rstrip('\n'))
    x = int(input().rstrip('\n'))
    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__':
    slove()

Solution (Python):
list = [int(input()) for i in range(3)]
A,B,C =list[0],list[1],list[2]
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())

counter = 0

for i in range(0, a + 1):
	if x - (500 * i) >= 0:
		x_f = x - (500 * i)

		if x_f == 0:
			counter += 1
			break

		for j in range(0, b + 1):
			if x_f - (100 * j) >= 0:
				x_s = x_f - (100 * j)

				if x_s == 0:
					counter += 1
					break

				for k in range(0, c + 1):
					if x_s - (50 * k) >= 0:
						x_t = x_s - (50 * k)

						if x_t == 0:
							counter += 1
							break


print(counter)

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

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

ans = 0
for a in range(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:
                ans += 1
print(ans)

Solution (Python):
A, B, C, X = [int(input()) for _ in range(4)]
cnt = 0
for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            if 500 * l + 100 * m + 50 * n == X:
                cnt += 1
print(cnt)

Solution (Python):
a=int(input())
b=int(input())
c=int(input())
x=int(input())
s=[]
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            s.append(500*i+100*j+50*k)
print(s.count(x))

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

for _a in range(a+1):
        for _b in range(b+1):
                for _c in range(c+1):
                        if 500*_a + 100*_b + 50*_c == x:
                                ans += 1
print(ans)

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

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

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a=int(input())
b=int(input())
c=int(input())
x=int(input())

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

print(count)

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

    cnt = 0

    for d in range(0,a+1):
        for e in range(0,b+1):
            for f in range(0,c+1):
                g = 500*d + 100*e + 50*f
                if g == x:
                    cnt += 1
    print(cnt)

bb087()

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

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

Solution (Python):

a, b, c, X = [int(input()) for i in range(4)]
n = 0
for i in range(X//500+1):
    if i > a:
        pass
    else:
        Y = X - 500 * i
        for j in range(Y // 100 + 1):
            if j > b:
                pass
            else:
                Z = Y - 100 * j
                for k in range(Z // 50 + 1):
                    if k > c:
                        pass
                    elif Z - 50 * k == 0:
                        n += 1
                    else:
                        pass

print(n)

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

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

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

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

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 num_500 in range(0, a + 1):
    for num_100 in range(0, b + 1):
        for num_50 in range(0, c + 1):
            if num_500 * 500 + num_100 * 100 + num_50 * 50 == x:
                count += 1
                break
print(count)

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

count = 0
for num_500 in range(0, a + 1):
    for num_100 in range(0, b + 1):
        for num_50 in range(0, c + 1):
            if num_500 * 500 + num_100 * 100 + num_50 * 50 == x:
                count += 1
print(count)