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



Sample input:
2
2
2
100


Sample output:
2

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#500円玉100円玉50円玉をそれぞれ指定枚数持っているときに入力した額をちょうど払える払い方は何通りか
  
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0

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

print(cnt)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input()) /10
count =0

for ia in range(a,-1,-1):
    for ib in range(b,-1,-1):
        for ic in range(c,-1,-1):
            if ia*50 + ib*10 + ic*5 == x:
                count +=1
            elif ia*50 + ib*10 + ic*5 < x:
                break
        if ib >0 and ia*50 + (ib-1)*10 + c*5 < x:
            break
    if ia > 0 and (ia-1)*50 + b*10 + c*5< x:
        break
print(count)

Submission status: Accepted

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

    count = 0
    for ia in range(0, a+1):
        for jb in range(0, b+1):
            for kc in range(0, c+1):
                total = 500 * ia + 100 * jb + 50 * kc
                if total == x:
                    count += 1

    print(count)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
A, B, C, X = [int(input()) for _ in range(4)]
cnt = 0

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

print(cnt)

Submission status: Accepted

Solution code:
import numpy as np

A_500 = int(input())
B_100 = int(input())
C_50 = int(input())
X = int(input())

A_prob = np.arange(0, A_500 + 1) * 500
B_prob = np.arange(0, B_100 + 1) * 100
C_prob = np.arange(0, C_50 + 1) * 50

sum_prob_list = []
for A in A_prob:
    for B in B_prob:
        for C in C_prob:
            sum_prob_list.append(str(A + B + C))
            
print(sum_prob_list.count(str(X)))

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a = f()[0]
    b = f()[0]
    c = f()[0]
    x = f()[0]

    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)


solve()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
a,b,c,x=int(input()),int(input()),int(input()),int(input())
l=[]
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:
            l.append(1)
            
print(len(l))

Submission status: Accepted

Solution code:
#
# abc087 b
#
a = int(input())
b = int(input())
c = int(input())
x = int(input())

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

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(y)

Submission status: Accepted

Solution code:
import itertools

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

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

print(ans)

Submission status: Accepted

Solution code:
data = [input() for x in range(0, 4, 1)]

x = int(data[0])
y = int(data[1])
z = int(data[2])
p = int(data[3])

cnt = 0

for i in range(0, x + 1, 1):
  for j in range(0, y + 1, 1):
    for k in range(0, z + 1, 1):
      tmp_total = 500 * i + 100 * j + 50 * k
      if tmp_total == p:
        #print("{0} {1} {2}".format(i, j, k))
        cnt += 1
      else:
        pass
      
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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):
      sum = i*500 + j*100 + k*50
      if sum == x:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

ans = 0
n = math.floor(x/500) + 1
for i in range(n)[0:a+1]:
  m = math.floor((x - 500*i)/100) + 1
  for j in range(m)[0:b+1]:
    l = (x - 500*i - 100*j)
    if l <= 50*c:
      ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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):
                tmp = 500*i + 100*j + 50*k
                if tmp==x:
                    ans += 1
    return ans
            
inf = [int(input()) for i in range(4)]
print(solve(inf[0],inf[1],inf[2],inf[3]))

Submission status: Accepted

Solution code:
coin500 = int(input())
coin100 = int(input())
coin050 = int(input())
target = int(input())
x = 0
 
for a in range(coin500+1):
  for b in range(coin100+1):
    for c in range (coin050+1):
     if target == a * 500 + b * 100 + c * 50:x += 1
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, x = [int(input()) for _ in range(4)]
print(sum([((x-500*i-100*j)%50==0 and 0<=(x-500*i-100*j)//50<=c) for i in range(a+1) for j in range(b+1)]))

Submission status: Accepted

Solution code:
a, b, c, x = [int(input()) for _ in range(4)]
cnt = 0
for i in range(a + 1):
    for j in range(b + 1):
        left = x - 500 * i - 100 * j
        if left % 50 == 0 and 0 <= left // 50 <= c:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:

# 整数の入力
a = input()
a = int(a)

b = input()
b = int(b)

c = input()
c = int(c)

x = input()
x = int(x)

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans.count(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input()) #500
b = int(input()) #100
c = int(input()) #50
x = int(input()) #Total

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)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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):
            sum = 500 * a + 100 * b + 50 * c
            if sum == x:
                ans += 1

print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
cnt=0
A=int(input())
B=int(input())
C=int(input())
X=int(input())

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

Submission status: Accepted

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


def patern(A,B,C,X):
	res = 0;
	for a in range(A+1):
		for b in range(B+1):
			for c in range(C+1):
				total = 500*a + 100*b + 50*c
				if total == X: res += 1
	print(res)

patern(A,B,C,X)

Submission status: Accepted

Solution code:
##### ABC087B - Coins
a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

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

Submission status: Accepted

Solution code:
##### ABC087B - Coins
a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

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

Submission status: Accepted

Solution code:
## ABC087B - Coins
import sys
input = sys.stdin.readline

a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

for i in range(min(a, int(x / 500)) + 1):
    for j in range(min(b, int((x - i * 500) / 100)) + 1):
        for k in range(c + 1):
            if i * 500 + j * 100 + k * 50 > x:
                break
            if i * 500 + j * 100 + k * 50 == x:
                count += 1
print(count)

Submission status: Accepted

Solution code:
## ABC087B - Coins
import sys
input = sys.stdin.readline

a, b, c, x = list(map(int, [input().rstrip() for _ in range(4)]))
count = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,x=map(int,open(0).read().split())
cnt=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 :
                cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1) :
    if ((x-500*i) > 100*b + 50*c) or (500*i > x) :
        ans += 0
    else :
        for j in range(b+1) :
            if ((x-500*i-100*j) > 50*c) or (100*j > (x-500*i)) :
                ans += 0
            else :
                ans += 1
print(ans)

Submission status: Accepted

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

count = 0
for comb_a in range(min(int(x / 500), a) + 1):
	current_x = x - comb_a * 500
	for comb_b in range(min(int(current_x / 100), b) + 1):
		current_x = x - comb_a * 500 - comb_b * 100
		if current_x / 50 <= c:
			count += 1
			# print(comb_a, comb_b, int(current_x / 50))

print(count)

Submission status: Accepted

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

ans = 0 
for i in range(0, A + 1):
  numi = i * 500
  if numi == X:
    ans += 1
  elif numi < X:
    for j in range(0, B + 1):
      numj = j * 100 + numi
      if numj == X:
        ans += 1
      elif numj < X:
        for k in range(0, C + 1):
          numk = k * 50 + numj
          if numk == X:
            ans += 1
          elif numk < X:
            continue
          else:
            break
      else:
        break
  else:
    continue
print(ans)

Submission status: Accepted

Solution code:
a,b,c,x=map(int,open(0).read().split())
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+=1
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a=0
b=0
c=0
t=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 Y==X:
                t=t+1

print(t)

Submission status: Accepted

Solution code:
a = input()
b = input()
c = input()
x = input()
a=int(a)
b=int(b)
c=int(c)
x=int(x)
i=0
j=0
k=0
l=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:
                l=l+1
print(l)

Submission status: Accepted

Solution code:
import sys

def main():
    A = [int(input()) for i in range(3)]
    X = int(input())
    print(counter(A, X))

def counter(A, X):
    count = 0
    for a in range(A[0] + 1):
        for b in range(A[1] + 1):
            for c in range(A[2] + 1):
                total = 500*a + 100*b + 50*c
                if total == X: count += 1
    return count

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for l in range(A+1):
  for m in range(B+1):
    for n in range(C+1):
      x = l * 500 + m * 100 + n * 50
      if x == X:
        counter += 1
print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,x=[int(input()) for i in range(4)]
cnt=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
		if (x-500*i-100*j)<=50*c:cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import sys
import subprocess
import re
import datetime
import os


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)

Submission status: Accepted

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

cnt=0

for i in range(a+1):
    newx=x
    newx=x-500*i
    for j in range(b+1):
        newx2=newx-100*j
        for k in range(c+1):
            newx3=newx2-50*k
            
            if newx3==0:
                cnt+=1
            else:
                continue

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:UTF-8
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for aa in range(a+1):
  for bb in range(b+1):
    for cc in range(c+1):
      if aa*500+bb*100+cc*50 == x:
        count = count+1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

# if 500 then
# a = 1, b = 5, b = 4,c = 2, b = 3, c = 4...

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

print(count)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C  =int(input())
X = int(input())
count = 0

for i in range(A + 1):
    total = i * 500
    if total == X:
        count += 1
        continue
    if total > X:
        break

    for j in range(B + 1):
        total = i * 500
        total += j * 100

        if total == X:
            count += 1

        if total > X:
            break

        for k in range(1,C + 1):
            total += 50

            if total == X:
                count += 1


            if total > X:
                break
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())//50
p = 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:
                p += 1
print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0

for ai in range(a+1):
    diff = x - 500 * ai
    if diff < 0:
        break
    for bi in range(b+1):
        diff = x - 500 * ai - 100 * bi
        if diff < 0:
            break
        # for ci in range(c+1):
        #     diff = x - 500 * ai - 100 * bi - 50 * ci
        #     if diff == 0:
        #         cnt += 1
        if diff % 50 == 0 and int(diff / 50) <= c:
            cnt += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

tmp = X
ans = 0
for i in range(min(A+1, X//500+1)):
    X -= 500*i
    if X == 0:
        ans += 1
        break
    tmp_2 = X
    for j in range(min(B+1, X//100+1)):
        X -= 100*j
        if X == 0:
            ans += 1
            break
        else:
            if 50*C >= X:
                ans += 1
        X = tmp_2
    X = tmp

print(ans)

Submission status: Accepted

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

tmp = X
ans = 0
for i in range(min(A+1, X//500+1)):
    X -= 500*i
    if X == 0:
        ans += 1
        break
    for j in range(min(B+1, X//100+1)):
        tmp_2 = X
        X -= 100*j
        if X == 0:
            ans += 1
            break
        else:
            if 50*C >= X:
                ans += 1
        X = tmp_2
    X = tmp

print(ans)