A = int(eval(input()))

B = int(eval(input()))

C = int(eval(input()))

X = int(eval(input()))

var = 0

for i in range(A+1):

  if (X-500*i) >= 0:

    Y = X-500*i

    for j in range(B+1):

      if ((Y-100*j) >= 0) and (((Y-100*j)//50) <= C):

        var = var+1

print(var)
s = [int(eval(input())) for i in range(4)]

var = 0

for i in range(s[0]+1):

  if (s[3]-500*i) >= 0:

    Y = s[3]-500*i

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

      if ((Y-100*j) >= 0) and (((Y-100*j)//50) <= s[2]):

        var = var+1

print(var)
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
var = 0
for i in range(A + 1):
    if (X - 500 * i) >= 0:
        Y = X - 500 * i
        for j in range(B + 1):
            if ((Y - 100 * j) >= 0) and (((Y - 100 * j) // 50) <= C):
                var = var + 1
print(var)

s = [int(eval(input())) for i in range(4)]
var = 0
for i in range(s[0] + 1):
    if (s[3] - 500 * i) >= 0:
        Y = s[3] - 500 * i
        for j in range(s[1] + 1):
            if ((Y - 100 * j) >= 0) and (((Y - 100 * j) // 50) <= s[2]):
                var = var + 1
print(var)

-A = int(eval(input())) -B = int(eval(input())) -C = int(eval(input())) -X = int(eval(input())) +s = [int(eval(input())) for i in range(4)] -for i in range(A + 1): -    if (X - 500 * i) >= 0: -        Y = X - 500 * i -        for j in range(B + 1): -            if ((Y - 100 * j) >= 0) and (((Y - 100 * j) // 50) <= C): +for i in range(s[0] + 1): +    if (s[3] - 500 * i) >= 0: +        Y = s[3] - 500 * i +        for j in range(s[1] + 1): +            if ((Y - 100 * j) >= 0) and (((Y - 100 * j) // 50) <= s[2]):