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:
import math

#n = int(input())
a = int(input())
b = int(input())
c = int(input())
x = int(input())
#a,b = list(map(int,input().split(" ")))
#ls = list(input().split(" "))
#ls = list(map(int,input().split(" ")))
#a,b = list(input().split())
#string = input()
#ls = [int(input()) for i in range(n)]
#ls1 = [input() for i in range(n)]
#m = int(input())
#ls2 = [input() for i in range(m)]
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)

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

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

count = 0
for i in range(min(A, X//500) + 1):
  X_pool = X
  if X - 500 * i >= 0:
    X_pool = X_pool - 500 * i
    for j in range(min(B, X_pool//100) + 1):
      X_pool_2 = X_pool
      if X_pool - 100 * j >= 0:
        X_pool_2 = X_pool - 100 * j
        if X_pool_2%50 == 0 and X_pool_2//50 <= C :
            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):
    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())

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())
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 + k*50
      if total == X:
        count +=1
        
print(count)

Submission status: Accepted

Solution code:
five = int(input())
one = int(input())
fifty = int(input())
x = int(input())
count = 0

for FIVE in range(five+1):
    for ONE in range(one+1):
        for FIFTY in range(fifty+1):
            if FIVE*500 + ONE*100 + FIFTY*50 == x:
                count += 1
print(count)

Submission status: Accepted

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

cnt = 0
for a500 in range(A + 1):
    if a500 * 500 > X:
        break
    for b100 in range(B+1):
        if a500 * 500 + b100 * 100 > X:
            break
        for c50 in range(C+1):
            if a500 * 500 + b100 * 100 + c50 * 50 == X:
                cnt += 1
            else:
                if a500 * 500 + b100 * 100 + c50 * 50 > X:
                    break
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 500 * i + 100 * j + 50 * k == x:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
a, b, c = map(int, [input() for _ in range(3)])
d = int(input())
e = 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 == 0:
                e += 1
print(e)

Submission status: Accepted

Solution code:
aa = int(input()) + 1
bb = int(input()) + 1
cc = int(input()) + 1
x = int(input())
count = 0

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

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() )
B=int( input() )
C=int( input() )
target=int( input() )
num=0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500+b*100+c*50 == target:
                num+=1
print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c = IR(3)
    a -= b
    print(a % c)
    return

#B
def B():
    a, b, c, x, ans = II(), II(), II(), II(), 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)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
C500 = int(input())
C100 = int(input())
C50 = int(input())
X = int(input())
count = 0
for i in range(C500+1):
  for j in range(C100+1):
    for k in range(C50+1):
      TOTAL = 500*i+100*j+50*k
      if TOTAL == X:
        count += 1
        break
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(pattern)

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())
d = [500 * a + b * 100 + c * 50 for a in range(A+1) for b in range(B+1) for c in range(C+1)]
print(d.count(x))

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:
x = int(input())             # ５００円の枚数
y = int(input())             # 1００円の枚数
z = int(input())             # 50円の枚数
payment = int(input())

count = 0
for k in range(x + 1):
    for j in range(y + 1):
        for i in range(z + 1):
            ans = i * 50 + j * 100 + k * 500
            if ans == payment:
                count += 1

print(count)

Submission status: Accepted

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

for i in range(A+1) :
    for j in range(B+1):
        for k in range(C+1):
            sumX.append(500*i + 100*j + 50*k)
print(sumX.count(X))

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

Submission status: Accepted

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

baisu = x // 50

a_num = a * 10
b_num = b * 2
c_num = c

count = 0

for i in range(0,a_num + 1,10):
    for j in range(0,b_num + 1,2):
        num = baisu - (i + j)
        if(num >= 0 and num <= c_num):
            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(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:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == d:
                e += 1
print(e)

Submission status: Accepted

Solution code:
# ABC 87, B - coins

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())
X_div = int(X/50)
count = 0
for i in range(1+A):
    for j in range(1+B):
        for k in range(1+C):
            if(10*i + 2*j + k == X_div):
                count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

#3重ループする
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:
import sys
a=int(input())
b=int(input())
c=int(input())
x=int(input())

#とりあえずコーナケース
if 500*a+100*b+50*c<x:
    print(0)
    sys.exit()
elif 500*a+100*b+50*c==x:
    print(1)
    sys.exit()
elif c==0 and x%100!=0:
    print(0)
    sys.exit()
elif b==0 and c==0 and x%500!=0:
    print(0)
    sys.exit()

#3重ループする
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())

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

Solution code:
def main():
	A = int(input())
	B = int(input())
	C = int(input())
	X = int(input())
	ans = 0
	for i in range(A+1):
		five_h = 500*i
		if five_h > X:
			break
		for j in range(B+1):
			one_h = 100*j
			if five_h + one_h > X:
				break
			for k in range(C+1):
				fifty = 50*k
				total = five_h + one_h +fifty
				if total > X:
					break
				if total == X:
					ans += 1
	print(ans)


if __name__ == '__main__':
	main()

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

Submission status: Accepted

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

ans = 0
for i in range(0, min(a + 1, (x // 500) + 1)):
    start = min(500 * i, x)
    for j in range(0, min(b + 1, ((x - start) // 100) + 1)):
        start1 = min(start + j * 100, x)
        left = x - start1
        if left // 50 <= c:
            ans += 1
print(ans)

Submission status: Accepted

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

counter = 0

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

print(counter)

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(4)]

all=0

for j in range(l[0]+1):
    for k in range(l[1]+1):
        for m in range(l[2]+1):
            if l[3]==500*j+100*k+50*m:
                all=all+1


print(all)

Submission status: Accepted

Solution code:
from itertools import product

A = range(int(input()) + 1)
B = range(int(input()) + 1)
C = range(int(input()) + 1)
X = int(input())

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

Submission status: Accepted

Solution code:
#b = [int(e) for e in input().split()]
a=input()
a=int(a)
b=input()
b=int(b)
c=input()
c=int(c)
d=input()
d=int(d)


count=0

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

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a+100*b+50*c==X:
                cnt=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 500*i + 100*j + 50*k == X:
                ans = ans + 1
          
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
input = sys.stdin.readline
a = int(input())  # 500円の枚数
b = int(input())  # 100円の枚数
c = int(input())  # 50円の枚数
x = int(input())  # 目指したい合計金額

count = 0
for a_i in range(a+1):
  for b_i in range(b+1):
    for c_i in range(c+1):
      if x == a_i * 500 + b_i * 100 + c_i * 50:
        count += 1

print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC87 B

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

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
x = list(map(int,input().split()))
A = a[0]
B = b[0]
C = c[0]
X = x[0]
Count = 0
for i in range(A+1):
    for k in range(B+1):
        for t in range(C+1):
            if 500*i + 100*k + 50*t == 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:
# -*- coding: utf-8 -*-

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def coins():
	a = int(input())
	b = int(input())
	c = int(input())
	x = int(input())
	count = 0
	for ai in range(0, a + 1):
		for bi in range(0, b + 1):
			for ci in range(0, c + 1):
				if (500 * ai + 100 * bi + 50 * ci) == x:
					count += 1
	print(count)

coins()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
A = int(stdin.readline().rstrip())
B = int(stdin.readline().rstrip())
C = int(stdin.readline().rstrip())
X = int(stdin.readline().rstrip())
cnt = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            # print(500 * a + 100 * b + 50 * c)
            if 500 * a + 100 * b + 50 * c == X:
                cnt += 1
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(pattern)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(answer)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    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)
            


if __name__ == "__main__":
    main()

Submission status: Accepted

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

X //= 50
ans = 0
for i in range(A+1):
    for j in range(B+1):
        if 0 <= X - 10*i - 2*j <= C:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math

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

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

print(cnt)

Submission status: Accepted

Solution code:
d = [int(input()) for i in range(4)]
ans = 0
for i in range(d[0]+1):
	for j in range(d[1]+1):
		for k in range(d[2]+1):
			if 500*i + 100*j + 50*k == d[3]:
				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:
# coding: utf-8
# Your code here!

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

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)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(counter)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans=0
for ia in range(a+1):
    for ib in range(b+1):
        if 500*ia+100*ib+50*c>=x & x>=500*ia+100*ib: ans+=1
print(ans)

Submission status: Accepted

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

a = int(input()) #500:10
b = int(input()) #100:2
c = int(input()) #50:1
x = int(input())

x /=50
ans_num=0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			if(i*10+j*2+k == x):
				ans_num+=1

				#print("--")
				#print(i)
				#print(j)
				#print(k)
				#print(x)

print(ans_num)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=int(input()) # 500
b=int(input()) # 100
c=int(input()) # 50
x=int(input())
sum = []
count = 0

for i in range(0, a+1):
    asum = 500 * i
    for i in range(0, b+1):
        bsum = 100 * i
        for i in range(0, c+1):
            csum = 50 * i
            sum.append(asum + bsum + csum)

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

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:
# coding: utf-8
# 500円玉の枚数
a = int(input())
# 100円玉の枚数
b = int(input())
# 50円玉の枚数
c = int(input())
# 合計金額
x = int(input())
 
def main():
    flag = "FALSE"
    count = 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            for k in range(0, c+1):
                total = int(500*i+100*j+50*k)
                if total == x:
                    count = count + 1
                else:
                    pass
    print(count)
 
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A, B, C, X = [int(input()) for i in range(4)]
num = 0
for j in range(A+1):
    for k in range(B+1):
        for m in range(C+1):
            if 500 * j + 100 * k + 50 * m == X:
                num += 1
print("{}".format(num))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
X=int(input())
cnt=0
i=0
j=0
k=0
while i <= A:
  while j <= B:
    while k <= C:
      sum=500*i+100*j+50*k
      if sum== X:
        cnt+=1
      k+=1
    j+=1
    k=0
  i+=1
  j=0
  k=0
print(cnt)

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): #AだとA-1までループされないの気をつけてね
    for b in range(B+1):
        for c in range(C+1):
            if(a*500 + b*100 + c*50 == X):
                ans = ans + 1
                
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

counter = 0
for i in range(0, A+1):
    ans = X - 500 * i
    if ans > 0:
        for n in range(0, B+1):
            ans1 = ans - 100 * n
            if ans1 > 0 and (ans1 / 50) <= C:
                counter += 1
            elif ans1 == 0:
                counter += 1
    elif ans == 0:
        counter += 1
print(counter)

Submission status: Accepted

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

counter = 0
for i in range(0, A+1):
    for n in range(0, B+1):
        for t in range(0, C+1):
            total = 500 * i + 100 * n + 50 * t
            if total == X:
                counter += 1
print(counter)

Submission status: Accepted

Solution code:
s = [int(input()) for i in range(4)]
var = 0
for i in range(s[0]+1):
  if (s[3]-500*i) >= 0:
    Y = s[3]-500*i
    for j in range(s[1]+1):
      if ((Y-100*j) >= 0) and (((Y-100*j)//50) <= s[2]):
        var = var+1
print(var)