a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

x = int(eval(input()))

cnt = 0

for k in range(a+1):

  for j in range(b+1):

    for i in range(c+1):

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

        cnt += 1

print(cnt)
a = int(eval(input()))

b = int(eval(input()))

c = int(eval(input()))

x = int(eval(input()))

cnt = 0

aa=min(a,(x+a+1)//500)+1

bb=min(b,(x+b+1)//100)+1

cc=min(c,(x+c+1)//50)+1

for k in range(aa):

  for j in range(bb):

    for i in range(cc):

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

        cnt += 1

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

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
cnt = 0
aa = min(a, (x + a + 1) // 500) + 1
bb = min(b, (x + b + 1) // 100) + 1
cc = min(c, (x + c + 1) // 50) + 1
for k in range(aa):
    for j in range(bb):
        for i in range(cc):
            if 50 * i + 100 * j + 500 * k == x:
                cnt += 1
print(cnt)

-for k in range(a + 1): -    for j in range(b + 1): -        for i in range(c + 1): +aa = min(a, (x + a + 1) // 500) + 1 +bb = min(b, (x + b + 1) // 100) + 1 +cc = min(c, (x + c + 1) // 50) + 1 +for k in range(aa): +    for j in range(bb): +        for i in range(cc):