For this Question: Newton has 3 groups of cards. Group 1 has X total of cards, Group 2 has Y cards, Group 3 has Z cards. All X cards have 1 written on them, all Y cards have 0 written on them, all Z cards have -1 written on them.

Now Newton wants to pick C cards and add the values written on them. Help Newton pick C cards to get the maximum possible value.The only line of the input contains 4 integers, X, Y, Z and C.

Constraints:
1) 0 <= X, Y, Z <= 10^9
2) 1 <= k <= X+Y+Z;Print the maximum sum of any C cards.Sample Input 1:
3 2 1 4

Sample Output 1:
3

Explanation 1 :
Newton will pick 3 cards of 1 value and 1 card of 0 value.

 
Sample Input 2:
1 2 3 5

Sample Output 2:
-1, I have written this Solution Code: x,y,z,c = map(int, input().split())
ans=0
ans+=(x if c-x>=0 else c)
c-=x
if c>0:
    c-=y
if c>0:
    ans-=min(c,z)
print(ans), In this Programming Language: Python, Now tell me if this Code is compilable or not?