coin_list = []

for i in range(3):

    s = int(eval(input()))

    coin_list.append(s)

target = int(eval(input()))

counter = 0



for a in range(coin_list[0]+1):

    for b in range(coin_list[1]+1):

        for c in range(coin_list[2]+1):

            total = 500*a + 100*b + 50*c

            if total == target:

                counter = counter + 1



print(counter)
coin_list = []

for i in range(3):

    s = int(eval(input()))

    coin_list.append(s)

target = int(eval(input()))

counter = 0



for a in range(coin_list[0]+1):

    for b in range(coin_list[1]+1):

        for c in range(coin_list[2]+1):

            total = 500*a + 100*b + 50*c

            if total == target:

                counter = counter + 1

            if total > target:

                break



print(counter)
coin_list = []
for i in range(3):
    s = int(eval(input()))
    coin_list.append(s)
target = int(eval(input()))
counter = 0
for a in range(coin_list[0] + 1):
    for b in range(coin_list[1] + 1):
        for c in range(coin_list[2] + 1):
            total = 500 * a + 100 * b + 50 * c
            if total == target:
                counter = counter + 1
print(counter)

coin_list = []
for i in range(3):
    s = int(eval(input()))
    coin_list.append(s)
target = int(eval(input()))
counter = 0
for a in range(coin_list[0] + 1):
    for b in range(coin_list[1] + 1):
        for c in range(coin_list[2] + 1):
            total = 500 * a + 100 * b + 50 * c
            if total == target:
                counter = counter + 1
            if total > target:
                break
print(counter)

+            if total > target: +                break