max_n500 = int(eval(input()))

max_n100 = int(eval(input()))

max_n50 = int(eval(input()))

amount = int(eval(input()))



count = 0

for n500 in range(max_n500 + 1):

    for n100 in range(max_n100 + 1):

        for n50 in range(max_n50 + 1):

            if n500 * 500 + n100 * 100 + n50 * 50 == amount:

                count += 1

print(count)

max_n500 = int(eval(input()))

max_n100 = int(eval(input()))

max_n50 = int(eval(input()))

target_amount = int(eval(input()))



count = 0

for n500 in range(max_n500 + 1):

    amount_500 = n500 * 500

    if amount_500 > target_amount:

        break

    for n100 in range(max_n100 + 1):

        amount_100 = n100 * 100

        amount_500_100 = amount_500 + amount_100

        if amount_500_100 > target_amount:

            break

        for n50 in range(max_n50 + 1):

            amount_50 = n50 * 50

            current_amount = amount_500_100 + amount_50

            if current_amount == target_amount:

                count += 1

print(count)

max_n500 = int(eval(input()))
max_n100 = int(eval(input()))
max_n50 = int(eval(input()))
amount = int(eval(input()))
count = 0
for n500 in range(max_n500 + 1):
    for n100 in range(max_n100 + 1):
        for n50 in range(max_n50 + 1):
            if n500 * 500 + n100 * 100 + n50 * 50 == amount:
                count += 1
print(count)

max_n500 = int(eval(input()))
max_n100 = int(eval(input()))
max_n50 = int(eval(input()))
target_amount = int(eval(input()))
count = 0
for n500 in range(max_n500 + 1):
    amount_500 = n500 * 500
    if amount_500 > target_amount:
        break
    for n100 in range(max_n100 + 1):
        amount_100 = n100 * 100
        amount_500_100 = amount_500 + amount_100
        if amount_500_100 > target_amount:
            break
        for n50 in range(max_n50 + 1):
            amount_50 = n50 * 50
            current_amount = amount_500_100 + amount_50
            if current_amount == target_amount:
                count += 1
print(count)

-amount = int(eval(input())) +target_amount = int(eval(input())) +    amount_500 = n500 * 500 +    if amount_500 > target_amount: +        break +        amount_100 = n100 * 100 +        amount_500_100 = amount_500 + amount_100 +        if amount_500_100 > target_amount: +            break -            if n500 * 500 + n100 * 100 + n50 * 50 == amount: +            amount_50 = n50 * 50 +            current_amount = amount_500_100 + amount_50 +            if current_amount == target_amount: