Binary Search
The program fragment below performs binary search of an integer number in an array that is sorted in a nondescending order:
Before BinarySearch was called, N was set to some integer number from 1 to 10000 inclusive and array A was filled with a nondescending integer sequence.
It is known that the procedure has terminated with the message "Found item i = XXX in L = XXX comparisons" with some known values of i and L.
Your task is to write a program that finds all possible values of N that could lead to such message. However, the number of possible values of N can be quite big. Thus, you are asked to group all consecutive Ns into intervals and write down only first and last value in each interval.
Input
The input consists of a single line with two integers i and L (0 ≤ i < 10000 and 1 ≤ L ≤ 14), separated by a space.
Output
On the first line of the output write the single integer number K representing the total number of intervals for possible values of N. Then K lines shall follow listing those intervals in an ascending order. Each line shall contain two integers A_iand B_i (A_i ≤ B_i) separated by a space, representing first and last value of the interval.
If there are no possible values of N exist, then the output shall contain the single 0.