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: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] str=br.readLine().split(" ");

        int x=Integer.parseInt(str[0]);
        int y=Integer.parseInt(str[1]);
        int z=Integer.parseInt(str[2]);
        int c=Integer.parseInt(str[3]);

        if(x >= c)
        {
            System.out.println(c);
        }
        else if(x+y >= c)
        {
            System.out.println(x);

        }
        else if(x+y+z >= c)
        {
            System.out.println(x - (c - (x+y)));
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?