D0 is the string Fa. For n≥1, build Dn by rewriting every character of Dn−1:
a becomes aRbFR.b becomes LFaLb.F, L, and R stay as they are.So D0 is Fa, D1 is FaRbFR, and D2 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) facing (0,1). The picture drawn by running all of Dn is the dragon curve of order n, and the image above is D10.
One F counts as one step. Run the commands of DN from the beginning and report where the cursor is once it has finished step X.
The input holds several test cases. Each line has two integers X and N separated by one space, and the input ends at end of file.
0≤X≤1013 and 0≤N≤100. X never exceeds the number of F characters in DN. If X is 0, the cursor has not moved yet.
For each test case, print the x coordinate and the y coordinate of the cursor on one line, separated by one space.