#!/usr/bin/env python3

# -*- coding: utf-8 -*-

import math



l = []

for _ in range(4):

  l.append(int(eval(input())))



a, b, c, x = l

# 最大使用可能回数

a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )

b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )

c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )



i, j, k, sum, cnt = [0] * 5  

while (i <= a_c):

  sum = x - 500 * i

  if sum < 0:

    break

  if sum == 0:

    cnt += 1



  else:

    while (j <= b_c):

      sum = x - 500 * i - 100 * j

      if sum < 0:

        break

      if sum == 0:

        cnt += 1



      else:

        while (k <= c_c):

          sum = x - 500 * i - 100 * j - 50 * k

          if sum < 0:

            break

          if sum == 0:

            cnt += 1

          k += 1

        k = 0



      j += 1

    j = 0



  i += 1



print(cnt)
#!/usr/bin/env python3

# -*- coding: utf-8 -*-

import math



l = []

for _ in range(4):

  l.append(int(eval(input())))



a, b, c, x = l

# 最大使用可能回数

a_c = min(a, math.floor(x / 500) if x >= 500 else 0 )

b_c = min(b, math.floor(x / 100) if x >= 100 else 0 )

c_c = min(c, math.floor(x / 50)  if x >= 50  else 0 )



sum, cnt = [0] * 2  

for i in range(a_c + 1):

  sum = x - 500 * i

  if sum == 0:

    cnt += 1

  if sum <= 0:

    break

  for j in range(b_c + 1):

    sum = x - 500 * i - 100 * j

    if sum == 0:

      cnt += 1

    if sum <= 0:

      break

    for k in range(c_c + 1):

      sum = x - 500 * i - 100 * j - 50 * k

      if sum == 0:

        cnt += 1

      if sum <= 0:

        break

print(cnt)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math

l = []
for _ in range(4):
    l.append(int(eval(input())))
a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0)
b_c = min(b, math.floor(x / 100) if x >= 100 else 0)
c_c = min(c, math.floor(x / 50) if x >= 50 else 0)
i, j, k, sum, cnt = [0] * 5
while i <= a_c:
    sum = x - 500 * i
    if sum < 0:
        break
    if sum == 0:
        cnt += 1
    else:
        while j <= b_c:
            sum = x - 500 * i - 100 * j
            if sum < 0:
                break
            if sum == 0:
                cnt += 1
            else:
                while k <= c_c:
                    sum = x - 500 * i - 100 * j - 50 * k
                    if sum < 0:
                        break
                    if sum == 0:
                        cnt += 1
                    k += 1
                k = 0
            j += 1
        j = 0
    i += 1
print(cnt)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math

l = []
for _ in range(4):
    l.append(int(eval(input())))
a, b, c, x = l
# 最大使用可能回数
a_c = min(a, math.floor(x / 500) if x >= 500 else 0)
b_c = min(b, math.floor(x / 100) if x >= 100 else 0)
c_c = min(c, math.floor(x / 50) if x >= 50 else 0)
sum, cnt = [0] * 2
for i in range(a_c + 1):
    sum = x - 500 * i
    if sum == 0:
        cnt += 1
    if sum <= 0:
        break
    for j in range(b_c + 1):
        sum = x - 500 * i - 100 * j
        if sum == 0:
            cnt += 1
        if sum <= 0:
            break
        for k in range(c_c + 1):
            sum = x - 500 * i - 100 * j - 50 * k
            if sum == 0:
                cnt += 1
            if sum <= 0:
                break
print(cnt)

-i, j, k, sum, cnt = [0] * 5 -while i <= a_c: +sum, cnt = [0] * 2 +for i in range(a_c + 1): -    if sum < 0: -        break -    else: -        while j <= b_c: -            sum = x - 500 * i - 100 * j -            if sum < 0: -                break +    if sum <= 0: +        break +    for j in range(b_c + 1): +        sum = x - 500 * i - 100 * j +        if sum == 0: +            cnt += 1 +        if sum <= 0: +            break +        for k in range(c_c + 1): +            sum = x - 500 * i - 100 * j - 50 * k -            else: -                while k <= c_c: -                    sum = x - 500 * i - 100 * j - 50 * k -                    if sum < 0: -                        break -                    if sum == 0: -                        cnt += 1 -                    k += 1 -                k = 0 -            j += 1 -        j = 0 -    i += 1 +            if sum <= 0: +                break