public static void main(String[] args) {
		// TODO Auto-generated method stub
		
	     int n = Integer.parseInt(args[0]);		//n is between 3 and 1000; 
	     int k = Integer.parseInt(args[1]);		//k is an integer between 0 and n;
	     int v = Integer.parseInt(args[2]);		//v is in {0,1,2,3}.
	     
	     N = n; K = k;		// Copy n, k to N, K for the convenience of subsequent retrieval
	     
	     int [] A = new int [n+1];	// 	The array that holds the data
	     
	     long sum = 0;  // The total counts of all possible permutations/combinations
	     
	     long startTime=0, endTime=0;	// The start and end time of running the algorithm
	     
	     switch(v){	// Test verbose to determine the output mode
	     
	     	/* If v = 0, the program outputs one line with 2 integers:
	     	 * 		the number of permutations of k objects out of n distinct objects, 
	     	 * 		the time taken by the program in milliseconds. 
	     	 * */
	     	case 0: {
	     		
	     		// Initialize array A with 1...n 
	     	    for(int i = 1; i <= n; i++){
	   	    	 A[i] = i;
	   	        }
	     	    
	     	    A[0] = -1;	// Introduce a sentinel A[0], which is strictly less than the largest element in A[1...n].
	     	    
	     	    //visit P(n, k) and get the number of all possible permutations
	     	    startTime = System.currentTimeMillis();
	     	    sum = permutation(A, n, k, v); 	
	            endTime = System.currentTimeMillis();
	            
	     		break;
	     	}
	     	
	        /* If v = 1, the program again outputs one line with 2 integers:
	     	 * 		the number of permutations of k objects out of n distinct objects, 
	     	 *  	the time taken by the program in milliseconds. 
	     	 * */
	     	case 1: {
	     		
	     		// Initialize array A with {0}. When an object is selected, A[i] = 1; otherwise A[i] = 0
	   	        for(int i = 1; i <= n; i++){
	   	    	   A[i] = 0;
	   	        }
	   	        
	   	        // visit C(n, k) and get the number of all possible combinations
	   	        startTime = System.currentTimeMillis();
	   	        sum = combination(A, n, k, v);	
	            endTime = System.currentTimeMillis();
	            
	     		break;
	     	}
	     	
	     	/* If v = 2, the program should output:
	     	 * 		all the actual permutations, one line at a time, 
	     	 * 		and then the output of v=0.
	     	 * */
	     	case 2: {
	     		
	     		// Initialize array A with 1...n 
	     	    for(int i = 1; i <= n; i++){
	   	    	A[i] = i;
	     	    }
	     	    
	     	    A[0] = -1;	// Introduce a sentinel A[0], which is strictly less than the largest element A[n].
	     	   
	     	    //visit P(n, k) and get the number of all possible permutations
	     	    startTime = System.currentTimeMillis();
	     	    sum = permutation(A, n, k, v); 	
	            endTime = System.currentTimeMillis();
	            
	     	    break;
	     		
	     	}
	     	
	     	/* If v = 3, the program should output:
	     	 * 		all the actual combinations, one line at a time, 
	     	 * 		and then the output of v=1.
	     	 * */
	     	case 3: {
	     		
	     		// Initialize array A with {0}. When an object is selected, A[i] = 1; otherwise A[i] = 0
	     		for(int i = 1; i <= n; i++){
		   	    	   A[i] = 0;
		   	     }
	     		
	     		// visit C(n, k) and get the number of all possible combinations
	     		startTime = System.currentTimeMillis();
	     		sum = combination(A, n, k, v);    
		        endTime = System.currentTimeMillis();
		        
	     		break;
	     	}
	     	
	       default: break;
	     }
	     
	     // Print the total counts of all possible permutations/combinations and the time taken by the program in milliseconds.
	     System.out.println(sum + " " +(endTime - startTime));
	}