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: a=int(input())
  b=int(input())
  c=int(input())
  x=int(input())
  ans=0
  for i in range(a+1):
    A=i*500
    for j in　range(b+1):
      B=j*100
      for k in range(c+1):
        C=k*50
        
        if A+B+C=x:
          ans+=1
  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"}]