X = [int(eval(input())) for _ in range(4)]

ans = 0

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

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

        for k in range(X[2] + 1):

            if 500 * i + 100 * j + 50 * k == X[3]:

                ans += 1

print(ans)
a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

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

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(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)

-X = [int(eval(input())) for _ in range(4)] +a = int(eval(input())) +b = int(eval(input())) +c = int(eval(input())) +x = int(eval(input())) -for i in range(X[0] + 1): -    for j in range(X[1] + 1): -        for k in range(X[2] + 1): -            if 500 * i + 100 * j + 50 * k == X[3]: +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: