Chronicles of the Archivist R2-A2#11846

Chronicles of the Archivist R2-A2

1 second
256 megabytes
Medium

In the secret vault of the Jedi, protocol R2-A2 stores a message that initially consists of a single letter A. Every second, the droid–archivist launches a self-encryption program that applies the following transformations to each byte:

After seconds, the Jedi Council seeks to determine:

  1. the number of bytes in the encrypted message (modulo 10^{9}+7);

  2. the byte at position (-based indexing).

Input

In a single line, two integers and are given (0 \le n \le 10^6, 1 \le k \le \min(S,10^9)), where is the length of the message after seconds.

Output

In a single line, output two values separated by a space:

  1. the number of bytes after seconds of encryption (modulo 10^{9}+7);

  2. the character (A, B, or C) at position .

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Note

In the first example, n=4, k=4. The per-second transformations of the string:

\begin{aligned} &S_1: \mathrm{A} \;\xrightarrow{1}\;\mathrm{C},\\ &S_2: \mathrm{C} \;\xrightarrow{2}\;\mathrm{B},\\ &S_3: \mathrm{B} \;\xrightarrow{3}\;\mathrm{BCA},\\ &S_4: \mathrm{BCA}\;\xrightarrow{4}\;\mathrm{BCABC}. \end{aligned}

Therefore, |S_4|=5, and the character at position 4 is B.