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: # distutils: language=c++
  # cython: language_level=3
  # cython: boundscheck=False
  # cython: wraparound=False
  # cython: infer_types=True
  # cython: cdivision=True
  # False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。
  
  
  
  # define 
  ctypedef long long LL
  
  # 読み込みはpython側で行う
  import sys
  readline = sys.stdin.buffer.readline
  read = sys.stdin.readline #文字列読み込む時はこっち
  
  cdef LL a_int(): return int(readline())
  
  cdef LL i,j,k,_
  
  
  cdef LL A=a_int()
  cdef LL B=a_int()
  cdef LL C=a_int()
  cdef LL X=a_int()
  
  # 愚直にシミュレーション
  cdef LL a,b,c,ans
  for a in range(A+1):
      for b in range(B+1):
          for c in range(C+1):
              ans += (500*a + 100*b + 50*c == X)
  print(ans)
  
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"}]