cn500 = int(eval(input()))

cn100 = int(eval(input()))

cn50 = int(eval(input()))

g_amount = int(eval(input()))



counter = 0



for i in range(cn500+1):

    for j in range(cn100+1):

        for n in range(cn50+1):

            if g_amount == (500 * i + 100 * j + 50 * n):

                counter += 1

                break

            elif g_amount < (500 * i + 100 * j + 50 * n):

                break



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

b = int(eval(input()))

c = int(eval(input()))

x = int(eval(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)

cn500 = int(eval(input()))
cn100 = int(eval(input()))
cn50 = int(eval(input()))
g_amount = int(eval(input()))
counter = 0
for i in range(cn500 + 1):
    for j in range(cn100 + 1):
        for n in range(cn50 + 1):
            if g_amount == (500 * i + 100 * j + 50 * n):
                counter += 1
                break
            elif g_amount < (500 * i + 100 * j + 50 * n):
                break
print(counter)

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

-cn500 = int(eval(input())) -cn100 = int(eval(input())) -cn50 = int(eval(input())) -g_amount = int(eval(input())) -counter = 0 -for i in range(cn500 + 1): -    for j in range(cn100 + 1): -        for n in range(cn50 + 1): -            if g_amount == (500 * i + 100 * j + 50 * n): -                counter += 1 -                break -            elif g_amount < (500 * i + 100 * j + 50 * n): -                break -print(counter) +a = int(eval(input())) +b = int(eval(input())) +c = int(eval(input())) +x = int(eval(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)