提示: 欢迎访问OurACM平台。
Problem 1622 Revival's odds

Accept: 62    Submit: 152
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

Everyone should be very familiar with Yang Hui Triangle, Yang Hui Triangle is shown as follows:

1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 ......................................

Its general form can be summarized as follows:

  • the n-th line contains n +1 values (begin from line 0)
  • for the k-th value in the n-th line(n>=1)
    • When k = 1 or k = n +1 its value is 1
    • When k! = 1 and k! = n +1 its value is the sum of the k-1th value in the n-1-th line and the k-th value in the n-1-th line

Now, your question is coming, oaiei would like to know the parity of the k-th value in the n-th line and he would like to know the number of odd in the n-th line.

Input

There are multiply tests. For each test, there are two integer n(1<=n<=10^9) and k(1<=k<=n+1).

Output

For each test, you should output two integer x and y, separating by a blank space, x denotes the parity of the k-th value in the n-th line, if the value is odd, you should output “1”, otherwise output “0”. y denotes the number of odd in the n-th line.

Sample Input

1 1 2 2

Sample Output

1 2 0 2

Source

Summer Training Qualification I

Submit  Back  Status  Discuss