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

ans = 0

for i in range(info[0] + 1):

  for j in range(info[1] + 1):

    k = (info[3] - (500*i + 100*j)) // 50

    if 0 <= k <= info[2]:

      ans += 1

print(ans)
A, B, C, X = [int(eval(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)

info = [int(eval(input())) for _ in range(4)]
ans = 0
for i in range(info[0] + 1):
    for j in range(info[1] + 1):
        k = (info[3] - (500 * i + 100 * j)) // 50
        if 0 <= k <= info[2]:
            ans += 1
print(ans)

-A, B, C, X = [int(eval(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) +info = [int(eval(input())) for _ in range(4)] +ans = 0 +for i in range(info[0] + 1): +    for j in range(info[1] + 1): +        k = (info[3] - (500 * i + 100 * j)) // 50 +        if 0 <= k <= info[2]: +            ans += 1 +print(ans)