Problem:
 Score : 200 points    Problem Statement You have A  500 -yen coins, B  100 -yen coins and C  50 -yen coins (yen is the currency of Japan).
In how many ways can we select some of these coins so that they are X yen in total?  Coins of the same kind cannot be distinguished. Two ways to select coins are distinguished when, for some kind of coin, the numbers of that coin are different.      Constraints  0 \leq A, B, C \leq 50  A + B + C \geq 1  50 \leq X \leq 20  000  A , B and C are integers.  X is a multiple of 50 .         Input Input is given from Standard Input in the following format:  A  B  C  X       Output Print the number of ways to select coins.        Sample Input 1 2
2
2
100      Sample Output 1 2  There are two ways to satisfy the condition:   Select zero 500 -yen coins, one 100 -yen coin and zero 50 -yen coins.  Select zero 500 -yen coins, zero 100 -yen coins and two 50 -yen coins.        Sample Input 2 5
1
0
150      Sample Output 2 0  Note that the total must be exactly X yen.       Sample Input 3 30
40
50
6000      Sample Output 3 213

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

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

Solution (Python):
a = [int(input()) for _ in range(4)]
print(len([1 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]]))

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

ans = 0
a = 0

while a <= A and a * 500 <= X:
	b = 0
	while b <= B and a * 500 + b * 100 <= X:
		if (X - 500 * a - 100 * b) // 50 <= C:
			ans += 1
		b += 1
	a += 1

print(ans)

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

print(Ans)

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

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

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

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

print(cnt)

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

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

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

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

tmp_sum = 0
for i in range(0, A+1):
    for j in range(0, B+1):
        for k in range(0, C+1):
            tmp_sum = 500 * i + 100 * j + 50 * k
            if tmp_sum == X:
                X_match_cnt += 1
                break
            elif tmp_sum > X:
                break
            else:
                continue

print(X_match_cnt)

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

Solution (Python):

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

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

print(count)

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

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

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

cnt = 0
for i in range(a + 1):
    ai = i * 500
    if x < ai:
        continue
    for j in range(b + 1):
        bj = j * 100
        if x < bj:
            continue
        for k in range(c + 1):
            ck = k * 50
            if x < ck:
                continue
            total = sum([ai, bj, ck])
            if total == x:
                cnt += 1
print cnt

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

cnt=0

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

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

ans = 0

c500 = X // 500

if c500 > A:
    c500 = A

for i in range(c500 + 1):
    c100 = (X - i*500) // 100
    if c100 > B:
        c100 = B
    for j in range(c100 + 1):
        c50 = (X - i*500 - j*100) // 50
        if c50 <= C:
           ans += 1

print(ans)

Solution (Python):
a,b,c,x=map(int,open(0));print(sum(1for i in range(a+1)for j in range(b+1)for k in range(c+1)if i*10+j*2+k==x/50))

Solution (Python):
import sys

input = sys.stdin.readline


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



if __name__ == '__main__':
    AtCoder().main()

Solution (Python):
import sys

input = sys.stdin.readline


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



if __name__ == '__main__':
    AtCoder().main()

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

count=0
for d in range(A+1):
  for e in range(B+1):
    for f in range(C+1):
      total = 500*d + 100*e +50*f
      if total == X:
      	count +=1

print(count)

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

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

print(result)

Solution (Python):
a_500 = int(input())
b_100 = int(input())
c_50 = int(input())
x_total = int(input())

counter = 0
for i in range(a_500 + 1):
    for j in range(b_100 + 1):
        for k in range(c_50 + 1):
            if x_total == i*500 + j*100 + k*50:
                counter += 1
print(counter)

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

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

count = 0

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

print(count)

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

ans = 0
for a in range(A + 1):
    for b in range(B + 1):
        q = (X - (500 * a + 100 * b)) / 50
        if q >= 0 and q <= C:
            ans += 1
print(ans)

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

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

Solution (Python):

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

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

print(count)

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

ans = 0

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

Solution (Python):
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIALOVaF0C/+19e3xU1bX/mcmD4ZUJCDQiStRRg0jIhACJz5nAwBmdQCABqSKHyWRCRicz+c2cgdCKQpNYxhCllVraai+3td7+2vtpaX8Wq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GI3nmzMSrY0jJ2XdW67mzZtV56qV6d7XPgxwaEY1agFyYIEgzvz3HXeOdIeCzPxXTX7vhcvHXIrALFwLxBKmNkEl1jrdw6KQaXwmjZzK+m0bDVVp1VrfskIsqssVz12FkRQ54/Y22DE6nwLRjfKWGVja5/YJB7MKKrGstdNHZt3noW6n/xgx9UtMrafQ1/hpX4+gqhpd4GGSffXWOLusB70CaK5FTKVIiHmzMvjJHK4leIKIrwgC3KOn7gelFSUbWkXVDigGT8QVJWZrPvqdH375QcLX7Z10klN23yHU3ehGN8ajUDCMH1JxevWJog9jT2ZTgX3gLU1af1V1WpK9C9sU/+to0xONcy2Vum8pS7Vndl+NycVfGZN/yY9jZsq78yRaivffISIr2ti6tBMM7vkzuzNLKpnfmGPTEr3e1lK6XB6NNesvJ3LClrQEZhr7ebVK6PMkJNH2Fzv4yJwPPP9AVWDr2IPmpjNH1VtlN/i+45UlfWPD9OkhzrxLEsSuQ9PeRZfsF9SYrg4GWXlVloCj9RV0GLPylUDpLxCuaqD/5H2G9c2uFdwAA'
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)



'''

def main2():
    stdin = open('/dev/stdin')
    A = int(stdin.readline())
    B = int(stdin.readline())
    C = int(stdin.readline())
    X = int(stdin.readline())
    count = 0
    for i in range(A + 1):
        for j in range(B + 1):
            for k in range(C + 1):
                if 500 * i + 100 * j + 50 * k == X:
                    count += 1
    print(count)

'''

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

cnt = 0

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

print (cnt)

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

ans = 0
for a in range(A + 1):
    for b in range(B + 1):
        q = (X - (500 * a + 100 * b)) / 50
        if q >= 0 and q <= C:
            ans += 1
print(ans)

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

c = 0

m500 = min(X//500, A) 
for i in range(m500+1):
  Y = X - i * 500
  m100 = min(Y//100, B) 
  for j in range(m100+1):
    Z = Y - j * 100
    if Z <= C*50:
      c += 1

print(c)

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

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

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

print(flg)

Solution (Python):
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 500 * aa + 100 * bb + 50 * cc == x:
                                    count += 1
print(count)

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

count = 0

for i in range(min(A, X // 500) + 1):
  tmp = X - 500 * i
  for j in range(min(B, tmp // 100) + 1):
    tmp2 = tmp - 100 * j
    k = tmp2 / 50
    if 0 <= k <= C:
      
      count += 1
      
print(count)

Solution (Python):
VALUES = [500, 100, 50]

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

ways = 0
for ia in range(a + 1):
  for ib in range(b + 1):
    for ic in range(c + 1):
      s = ia * VALUES[0] + ib * VALUES[1] + ic * VALUES[2]
      ways += (1 if s == x else 0)
      
print(ways)

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

Solution (Python):

money = [int(input()) for i in range(3)]
N = int(input())

res = 0

for l in range(money[0]+1):
    for m in range(money[1]+1):
        for n in range(money[2]+1):
            if N == 500*l + 100*m + 50*n:
                res += 1

print(res)

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

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

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

print(ans)

Solution (Python):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
while 500 * A > X:
    A = A - 1
while A >= 0:
    B_1 = B
    X_A = X - 500 * A
    while 100 * B_1 > X_A:
        B_1 = B_1 - 1
    while B_1 >= 0:
        X_B = X_A - 100 * B_1
        if 50 * C >= X_B:
            count = count + 1
        else:
            pass
        B_1 = B_1 - 1
    A = A - 1
print(count)

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

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

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

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

print(count)

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

print(ans)

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

Solution (Python):
import itertools

A = int(input())
B = int(input())
C = int(input())
X = int(input())//50
count = 0

for i,j,k in itertools.product(range(A+1),range(B+1),range(C+1)):
    if i*10+j*2+k == X:
        count += 1

print(count)

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

Solution (Python):


cA = 500
cB = 100
cC = 50

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):
            sum = cA * i + cB * j + cC * k
            if sum == x:
                cnt+=1

print(cnt)

Solution (Python):
A,B,C=int(input()),int(input()),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 a*500+b*100+c*50==X:
        res+=1

print(res)

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

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

print(count)

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

count = 0

for x in range(A+1):
    for y in range(B+1):
        for z in range(C+1):
            if x*500 + y*100 + z*50 == D:
                count += 1

print(count)

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

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

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

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

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

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


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

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

Solution (Python):
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;
    else:
        for j in range(b+1):
            if 500*i+100*j > x:
                break;
            elif (x-500*i-100*j)/50 <= c:
                ans += 1
print(ans)

Solution (Python):
def resolve():
    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):
                mon = 500 * ai + 100 * bi + 50 * ci
                if mon == x:
                    ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()