a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

x = int(eval(input()))

s = 0

for i in range(a+1):

    for j in range(b+1):

        for l in range(c+1):

            if 500*i+100*j+50*l == x:

                s += 1

print(s)



t = list(int(eval(input())) for _ in range(3))

x = int(eval(input()))

c = 0

for i in range(min(x//500,t[0])+1):

    a = t[:]

    d = x-500*i

    if d <= 100*a[1]+50*a[2]:

        for j in range(a[1]+1):

            if d >= 100*j:

                r = d-100*j

                if r <= 50*a[2]:

                    c += 1

            else:

                break

print(c)
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
s = 0
for i in range(a + 1):
    for j in range(b + 1):
        for l in range(c + 1):
            if 500 * i + 100 * j + 50 * l == x:
                s += 1
print(s)

t = list(int(eval(input())) for _ in range(3))
x = int(eval(input()))
c = 0
for i in range(min(x // 500, t[0]) + 1):
    a = t[:]
    d = x - 500 * i
    if d <= 100 * a[1] + 50 * a[2]:
        for j in range(a[1] + 1):
            if d >= 100 * j:
                r = d - 100 * j
                if r <= 50 * a[2]:
                    c += 1
            else:
                break
print(c)

-a = int(eval(input())) -b = int(eval(input())) -c = int(eval(input())) +t = list(int(eval(input())) for _ in range(3)) -s = 0 -for i in range(a + 1): -    for j in range(b + 1): -        for l in range(c + 1): -            if 500 * i + 100 * j + 50 * l == x: -                s += 1 -print(s) +c = 0 +for i in range(min(x // 500, t[0]) + 1): +    a = t[:] +    d = x - 500 * i +    if d <= 100 * a[1] + 50 * a[2]: +        for j in range(a[1] + 1): +            if d >= 100 * j: +                r = d - 100 * j +                if r <= 50 * a[2]: +                    c += 1 +            else: +                break +print(c)