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

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

                count += 1



print(count)

a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

x = int(eval(input()))



a = min(x//500, a)+1

b = min(x//100, b)+1

c = min(x//50, c)



cnt = 0



for i in range(a):

  for j in range(b):

    now = x-500*i-100*j

    if now>=0 and now//50 <= c:

      cnt +=1



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

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
a = min(x // 500, a) + 1
b = min(x // 100, b) + 1
c = min(x // 50, c)
cnt = 0
for i in range(a):
    for j in range(b):
        now = x - 500 * i - 100 * j
        if now >= 0 and now // 50 <= c:
            cnt += 1
print(cnt)

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