Function to count the number of ways to divide the number N in K groups such that each group has number of elements in range [ L , R ]
static int calculate ( int pos , int left , int k , int L , int R ) {