five_hnd = int(eval(input()))

one_hnd = int(eval(input()))

fifty = int(eval(input()))

target = int(eval(input()))

num = 0

for i in range(five_hnd + 1):

  for j in range(one_hnd + 1):

    for k in range(fifty + 1):

      sum = 500*i + 100*j + 50*k

      if (sum) == target :

        num +=1

print(num)
five_hund = int(eval(input()))

one_hund = int(eval(input()))

fifty = int(eval(input()))

X = int(eval(input()))

count = 0



for five in range(five_hund + 1):

  for one in range(one_hund + 1):

    for fif in range(fifty + 1):

      if(five * 500 + one * 100 + fif * 50 == X):

        count += 1

print(count)
five_hnd = int(eval(input()))
one_hnd = int(eval(input()))
fifty = int(eval(input()))
target = int(eval(input()))
num = 0
for i in range(five_hnd + 1):
    for j in range(one_hnd + 1):
        for k in range(fifty + 1):
            sum = 500 * i + 100 * j + 50 * k
            if (sum) == target:
                num += 1
print(num)

five_hund = int(eval(input()))
one_hund = int(eval(input()))
fifty = int(eval(input()))
X = int(eval(input()))
count = 0
for five in range(five_hund + 1):
    for one in range(one_hund + 1):
        for fif in range(fifty + 1):
            if five * 500 + one * 100 + fif * 50 == X:
                count += 1
print(count)

-five_hnd = int(eval(input())) -one_hnd = int(eval(input())) +five_hund = int(eval(input())) +one_hund = int(eval(input())) -target = int(eval(input())) -num = 0 -for i in range(five_hnd + 1): -    for j in range(one_hnd + 1): -        for k in range(fifty + 1): -            sum = 500 * i + 100 * j + 50 * k -            if (sum) == target: -                num += 1 -print(num) +X = int(eval(input())) +count = 0 +for five in range(five_hund + 1): +    for one in range(one_hund + 1): +        for fif in range(fifty + 1): +            if five * 500 + one * 100 + fif * 50 == X: +                count += 1 +print(count)