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: Wrong Answer

Solution code:


from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log
from itertools import *
import string
import copy
import random
import bisect
from decimal import *
def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
 
def mp():
    return map(int,str(raw_input()).split())
a=input()
b=input()
c=input()
x=input()
a+=1
b+=1
c+=1
ans=0
for i in range(a):
	for j in range(b):
		for k in range(c):
			if i*200+j*100+k*50==x:
				ans+=1
print ans

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
b = int(input())
c = int(input())
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: Wrong Answer

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

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

a = min(a, 20000 // 500 + 1)
b = min(b, 20000 // 100 + 1)
ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

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

import itertools
print(len([c for c in set(map(tuple, itertools.chain.from_iterable(itertools.combinations(itertools.chain(itertools.repeat(500, A), itertools.repeat(100, B), itertools.repeat(50, C)), r) for r in range(A + B + C + 1)))) if sum(c) == X]))

Submission status: Time Limit Exceeded

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

tried = []
coins = []

def dfs(a, b, c):
  if (a, b, c) in tried:
    return None
  tried.append((a, b, c))
  total = a*500 + b*100 + c*50  
  if total > x or a > a_num or b > b_num or c > c_num:
    return None
  elif total == x:
    coins.append((a, b, c))
  else:
    dfs(a+1, b, c)
    dfs(a, b+1, c)
    dfs(a, b, c+1)
    
dfs(0, 0, 0)
print(len(coins))

Submission status: Time Limit Exceeded

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

if min(A, B, C, X) == X:
	print(0)

def num_patterns(A, B, C, X):
    if X == 0:
      	return 1

    if min(A, B, C, X) == X:
        return 0
    branch_A = num_patterns(A - 1, B    , C    , X - 500) if A > 0 else 0
    branch_B = num_patterns(A    , B - 1, C    , X - 100) if B > 0 else 0
    branch_C = num_patterns(A    , B    , C - 1, X - 50 ) if C > 0 else 0
    return branch_A + branch_B + branch_C

print(num_patterns(A, B, C, X))

Submission status: Time Limit Exceeded

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

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())
sum_=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):
            check=500*i+100*j+50*k
            if(check==sum_):
                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):
            price = 500 * i + 100 * j + 50 * k
            if price == 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):
    X_ = X
    X_ -= 500*i
    for j in range(B+1):
        X__ = X_
        X__ -= 100*j
        for k in range(C+1):
            X___ = X__
            X___ -= 50*k
            if X___ == 0:
                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(0,A+1):
  a = 500*i
  
  for j in range(0,B+1):
    b = 100*j
    
    for k in range(0,C+1):
      c = 50*k
      
      if a + b + c == X:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
g = int(input())
tmp = []
for x in range(a+1):
    for y in range(b+1):
        for z in range(c+1):
            tmp.append(500*x + 100*y + 50*z)
ans = tmp.count(g)
print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
L = []
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:
                L.append((a,b,c))
print(len(L))

Submission status: Accepted

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

    return count


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
x=int(input())
if x%100>0 and c==0:
    print(0)
    exit()
else:
    a=min(a,x//500)
    b=min(b,x//100)
    c=min(c, x // 50)
    ans=0
    for i in range(a+1):
        for j in range(b+1):
            for c in range(c+1):
                if i*500+j*100+c*50==x:ans+=1
print(ans)

Submission status: Accepted

Solution code:
def main():

    five_hundred = int(input())
    one_hundred = int(input())
    fifty = int(input())
    x = int(input())
    ans = 0
    for i in range(five_hundred + 1):
        for j in range(one_hundred + 1):
            for k in range(fifty + 1):
                if 500 * i + 100 * j + 50 * k == 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())
res = 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:
        res += 1
print(res)

Submission status: Accepted

Solution code:
[a]=[int(i) for i in input().split()]
[b]=[int(i) for i in input().split()]
[c]=[int(i) for i in input().split()]
[x]=[int(i) for i in input().split()]
ans=0
for ia in range(a+1):
    for ib in range(b+1):
        for ic in range(c+1):
            if(ia*500+ib*100+ic*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
                break
            elif 500 * i + 100 * j + 50 * k > 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 = 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 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 (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):
      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())

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

print(cnt)

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)

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

Submission status: Accepted

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

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

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())
x1 = int(input())
x2 = 0
ans = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
                x2 = 500*i + 100*j + 50*k
                if (x2==x1):
                    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 = 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:
with open(0) as f:
    a, b, c, x = map(int, f.read().split())
cnt = 0
from itertools import product
for i,j,k in product(range(a+1), range(b+1), 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(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())
count = 0

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

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

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

ans = 0

for i in range(0, A+1, 1):
  for j in range(0, B+1, 1):
    for k in range(0, C+1, 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())

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

print(result)

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 = int(input())
B = int(input())
C = int(input())
X = int(input())

suma = 0
sumb = 0
sumc = 0

la = list([0])
lb = list([0])
lc = list([0])

ls = list()
for i in range(1,A+1):
    suma = suma + 500
    la.append(suma)

for i in range(1,B+1):
    sumb = sumb + 100
    lb.append(sumb)

for i in range(1,C+1):
    sumc = sumc + 50
    lc.append(sumc)

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            ls.append(la[i]+lb[j]+lc[k])
            
print(ls.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())

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("{}".format(count))

Submission status: Accepted

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

max_a = int( X / 500 )
if A < max_a :
  max_a = A
for a in reversed(range( max_a+1 )) :
  max_b = int( (X - 500 * a) / 100 )
  if B < max_b :
    max_b = B
  for b in reversed(range( max_b+1 )) :
    c = int ( ( X - 500 * a - 100 * b ) / 50 )
    if c > C :
      break
    ways += 1
print('%d' %ways ) ;

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 (x-(500*i + 100*j))%50==0 and ((x-(500*i+100*j))//50)<=c and (500*i+100*j)<=x:
            ans += 1
            #print(i, j)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a_coins = int(input())
b_coins = int(input())
c_coins = int(input())
x_num = int(input())

def money_match(a, b, c):
    money = 500 * a + 100 * b + 50 * c
    if money == x_num:
        return 1
    else:
        return 0
        
cnt = 0
for a in range(a_coins+1):
    for b in range(b_coins+1):
        for c in range(c_coins+1):
            if money_match(a, b, c) == 1:
                cnt += 1
                
print(cnt)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from itertools import islice, tee


def resolve(in_):
    A = int(next(in_))
    B = int(next(in_))
    C = int(next(in_))
    X = int(next(in_))

    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

    return ans


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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, 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:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    a = int(input())
    b = int(input())
    c = int(input())
    target = 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)==target:
                    count+=1
                else:
                    continue
    print(count)

if __name__=="__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt = 0
for an in range(a+1):
  for bn in range(b+1):
    for cn in range(c+1):
      if x == 500*an + 100*bn + 50*cn:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = 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==d:
        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 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())//50

ans = 0
for a, b, c in [(a, b, c) 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:
    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:
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(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, [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())

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

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

Submission status: Accepted

Solution code:
s = [int(input()) for i in range(4)]
A = s[0]
B = s[1]
C = s[2]
X = s[3]
res = 0
total = 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
#      print("A:"+str(a)+" B:"+str(b)+" C:"+str(c) + "total:"+str(total))
      if(total == X):res = res +1
print(res)

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):
        if (X - (500*i+100*j)) % 50 == 0 and X - (500*i+100*j) >= 0 and (X - (500*i+100*j)) // 50 <= C:
            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 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
import copy
import math
import itertools
import numpy as np

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

Submission status: Accepted

Solution code:
# 10
a = int(input())
# 2
b = int(input())
# 1
c = int(input())
x = int(int(input())/50)
d = [0] * x
ans = 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:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
mycode = r'''
# distutils: language=c++
# cython: language_level=3
# cython: boundscheck=False
# cython: wraparound=False
# cython: infer_types=True
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。



# define 
ctypedef long long LL

# 読み込みはpython側で行う
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち

cdef LL a_int(): return int(readline())

cdef LL i,j,k,_


A=a_int()
B=a_int()
C=a_int()
X=a_int() #あえて型をつけない(→実装が早くなる)

# 愚直にシミュレーション
cdef LL a,b,c,ans #他の定数はぶっちゃけ型を付ける必要がないですが、ループにはしっかりつけないと速度が低下する
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            ans += (500*a + 100*b + 50*c == X)
print(ans)


'''

import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    import os
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Submission status: Accepted

Solution code:
mycode = r'''
# distutils: language=c++
# cython: language_level=3
# cython: boundscheck=False
# cython: wraparound=False
# cython: infer_types=True
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。



# define 
ctypedef long long LL

# 読み込みはpython側で行う
import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち

cdef LL a_int(): return int(readline())

cdef LL i,j,k,_


cdef LL A=a_int()
cdef LL B=a_int()
cdef LL C=a_int()
cdef LL X=a_int()

# 愚直にシミュレーション
cdef LL a,b,c,ans
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            ans += (500*a + 100*b + 50*c == X)
print(ans)

'''

import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    import os
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Submission status: Accepted

Solution code:
a , b, c , x = [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 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())
con = 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:
        con += 1
print(con)

Submission status: Accepted

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

if x%50 > 0:
    print(0)
    exit()
    
ans = 0
for a_c in range(a+1):
    for b_c in range(b+1):
        amount = 500 * a_c + 100 * b_c
        if 0 <= x - amount <= 50 * c:
            ans += 1

print(ans)