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: import sys
  from collections import defaultdict, deque, Counter
  import math
  
  # import copy
  from bisect import bisect_left, bisect_right
  import heapq
  
  # sys.setrecursionlimit(1000000)
  
  # input aliases
  input = sys.stdin.readline
  
  getS = lambda: input().strip()
  getN = lambda: int(input())
  getList = lambda: list(map(int, input().split()))
  getZList = lambda: [int(x) - 1 for x in input().split()]
  
  INF = 10**20
  MOD = 10**9 + 7
  divide = lambda x: pow(x, MOD - 2, MOD)
  
  
  def nck(n, k, kaijyo):
      return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD
  
  
  def npk(n, k, kaijyo):
      if k == 0 or k == n:
          return n % MOD
      return (kaijyo[n] * divide(kaijyo[n - k])) % MOD
  
  
  def kaijyo(n):
      ret = [1]
      for i in range(1, n + 1):
          ret.append((ret[-1] * i) % MOD)
      return ret
  
  
  def solve():
      a = getN()
      b = getN()
      c = getN()
      x = getN()
      ans = 0
      for i in range(a + 1):
          for j in range(b + 1):
              for k in range(c + 1):
                  if 500 * i + 100 * j + 50 * k == x:
                      ans += 1
  
      print(ans)
  
  
  def main():
      n = getN()
      for _ in range(n):
          solve()
  
  
  if __name__ == "__main__":
      # main()
      solve()
  
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"}]