output_description: Print the maximum possible sum of the numbers written on the cards chosen.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      A B C K
attempt: list1 = list(map(int, input().split()))
  if list1[3] <= list1[0]:
      print(list1[0])
  else:
      a = list1[3] - list1[0]
      if a <= list1[1]:
          print(list1[0])
      else:
          b = a - list1[1]
          c = (-1) * b
          print(c)
  
problem_description: Statement
  
  We have A cards, each of which has an integer 1 written on it. Similarly, we
  also have B cards with 0s and C cards with -1s.
  
  We will pick up K among these cards. What is the maximum possible sum of the
  numbers written on the cards chosen?
samples: [{"input": "2 1 1 3", "output": "2\n    \n\nConsider picking up two cards with 1s and one card with a 0. In this case, the\nsum of the numbers written on the cards is 2, which is the maximum possible\nvalue.\n\n* * *"}, {"input": "1 2 3 4", "output": "0\n    \n\n* * *"}, {"input": "2000000000 0 0 2000000000", "output": "2000000000"}]