Dragon curve

No attempts yetTime limit1sMemory limit256 MB

Problem

D0D_0 is the string Fa. For n1n \ge 1, build DnD_n by rewriting every character of Dn1D_{n-1}:

  • a becomes aRbFR.
  • b becomes LFaLb.
  • F, L, and R stay as they are.

So D0D_0 is Fa, D1D_1 is FaRbFR, and D2D_2 is FaRbFRRLFaLbFR.

Read the string as drawing commands. F means move one unit forward along the current heading and draw the segment, L means turn 90 degrees left, and R means turn 90 degrees right. a and b do nothing. The cursor starts at (0,0)(0, 0) facing (0,1)(0, 1). The picture drawn by running all of DnD_n is the dragon curve of order nn, and the image above is D10D_{10}.

One F counts as one step. Run the commands of DND_N from the beginning and report where the cursor is once it has finished step XX.

Input

The input holds several test cases. Each line has two integers XX and NN separated by one space, and the input ends at end of file.

0X10130 \le X \le 10^{13} and 0N1000 \le N \le 100. XX never exceeds the number of F characters in DND_N. If XX is 0, the cursor has not moved yet.

Output

For each test case, print the xx coordinate and the yy coordinate of the cursor on one line, separated by one space.