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

m = 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:

                m += 1

print(m)

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

a, b, c, x = Li[0], Li[1], Li[2], Li[3]

ans = 0

for i in range(min(x//500, a)+1):

    for j in range(min((x-500*i)//100, b)+1):

        ans += 1 if (x-500*i-100*j)//50 <= c else 0

print(ans)

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

Li = [int(eval(input())) for _ in range(4)]
a, b, c, x = Li[0], Li[1], Li[2], Li[3]
ans = 0
for i in range(min(x // 500, a) + 1):
    for j in range(min((x - 500 * i) // 100, b) + 1):
        ans += 1 if (x - 500 * i - 100 * j) // 50 <= c else 0
print(ans)

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