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: a,b,c,k = input().split()
  a,b,c,k = int(a),int(b),int(c),int(k)
  s = 0
  if k<=a:
    s = s+k
  elif k>a:
    s = s+a
  k = k-s
  if k>0:
    k = k-b
  if k>0:
    k = k-c
    if k==0:
      s = s+(k*-1)
    else:
      s = s+(c*-1)
  print(s)
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"}]