output_description: Print the number of ways to select coins.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A
      B
      C
      X
attempt: # -*- coding: utf-8 -*-
  
  
  # 整数値入力 1文字の入力
  def input_one_number():
      return int(input())
  
  
  # 整数値龍力　複数の入力
  def input_multiple_number():
      return map(int, input().split())
  
  
  # 整数値龍力　複数の入力(配列)
  def input_multiple_number_as_list():
      return list(map(int, input().split()))
  
  
  # 2次元配列入力
  def input_map():
      return [list(map(int, list(input()))) for i in range(h)]
  
  
  # リスト出力
  def print_list(list):
      print(*list)
      return
  
  
  # 2次元配列出力
  def print_map(maplist):
      for i in maplist:
          print(*i, sep="")
      return
  
  
  # 素数生成
  def generate_primenums():
      n = 100
      primes = set(range(2, n + 1))
      for i in range(2, int(n**0.5 + 1)):
          primes.difference_update(range(i * 2, n + 1, i))
      primes = list(primes)
      return primes
  
  
  def memo():
      a = [0] * 5
      b = a  # 良くない配列のコピー
      b2 = a[:]  # 1次元のときはコピーはこれで良い
      a[1] = 3
      print("b:{}, b2:{}".format(b, b2))  # b:[0, 3, 0, 0, 0], b2:[0, 0, 0, 0, 0]
  
      import copy
  
      a = [[0] * 3 for i in range(5)]  # 2次元配列はこう準備、[[0]*3]*5だとだめ
      b = copy.deepcopy(a)  # 2次元配列はこうコピーする
  
      # 内包表記奇数のみ
      odd = [i for i in range(100) if i % 2 == 1]  # [1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
  
      # 二部探索
      import bisect
  
      a = [1, 2, 3, 5, 6, 7, 8, 9]
      b = bisect.bisect_left(a, 8)
  
      # combinations、組み合わせ、順列
      from itertools import (
          permutations,
          combinations,
          combinations_with_replacement,
          product,
      )
  
      a = ["a", "b", "C"]
      print(list(permutations(a)))
      print(list(combinations(a, 2)))
      print(list(combinations_with_replacement(a, 3)))
  
  
  # 階乗
  def kaijo(n):
      import math
  
      return math.factorial(n)
  
  
  # 選び方（コンビネーション nCr）
  def num_combination(n, r):
      import math
  
      return math.factorial(n) // math.factorial(n - r)
  
  
  # 最大公約数、最小公倍数
  def calc_gcd(a, b):
      import fractions
  
      GCD = fractions.gcd(a, b)
      lcm = a * b // gcd
      return gcd, lcm
  
  
  # 複数の最大公約数
  def calc_gcd_list(l):
      import numpy as np
  
      return np.gcd.reduce(l)
  
  
  A = input_one_number()
  B = input_one_number()
  C = input_one_number()
  X = input_one_number()
  
  cnt = 0
  for i in range(A + 1):
      for j in range(B + 1):
          for k in range(C + 1):
              if i * 500 + j * 100 + k * 50 == X:
                  cnt += 1
  
  print(cnt)
  
problem_description: Statement
  
  You have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the
  currency of Japan). In how many ways can we select some of these coins so that
  they are X yen in total?
  
  Coins of the same kind cannot be distinguished. Two ways to select coins are
  distinguished when, for some kind of coin, the numbers of that coin are
  different.
samples: [{"input": "2\n    2\n    2\n    100", "output": "2\n    \n\nThere are two ways to satisfy the condition:\n\n  * Select zero 500-yen coins, one 100-yen coin and zero 50-yen coins.\n  * Select zero 500-yen coins, zero 100-yen coins and two 50-yen coins.\n\n* * *"}, {"input": "5\n    1\n    0\n    150", "output": "0\n    \n\nNote that the total must be exactly X yen.\n\n* * *"}, {"input": "30\n    40\n    50\n    6000", "output": "213"}]