Arrow Operator

Time limit1sMemory limit512 MB

Summary
X equals the number of hyphens in the prefix merger trace: even 1 to 10 have widths 3, 6, 10, 10, 15, 21, 28, 36, 45, 55.
Level

Medium5 of 10

Topics
Math
Solved
No attempts yet

Problem

Note: This problem follows the C++11 and later standards.

Kipa, who was preparing a C++ study session for newcomers, found an interesting operator on the internet. It is the arrow operator (<--).

ProgramOutput
`#include

int main(){ int x = 10;

while( 0 <-- x ){ std::cout << x << std::endl; } return 0; }|9 8 7 6 5 4 3 2 1` |

With the arrow operator as shown above, the variable on the right of the operator moves toward the value on the left of the operator. This operator can even move the value faster by increasing the length of the arrow (the number of - characters).

ProgramOutput
`#include

int main(){ int x = 10;

while( 0 <---- x ){ std::cout << x << std::endl; } return 0; }|8 6 4 2` |

The first code, with an arrow length of 2, printed 9 numbers, but the second code, with the length increased to 4, printed only 4 numbers. The variable moved toward the value twice as fast.


In fact, this arrow operator is a joke built on the prefix decrement operator (--x), and 0 <-- x is a visual trick that makes --x > 0 look like an arrow. So the loop in the first code works as follows.

  1. Decrement the value of x by 1.
  2. If the value of x is not greater than 0, terminate the program.
  3. Print the value of x and return to the start.

The decrement operator has the following properties.

  • When several - appear in a row, they are always parsed two at a time from the front. For example, ------x is always parsed as -- -- --x, not as -- - -- -x or - -- - --x.
  • The decrement operator cannot be applied to an expression to which the unary minus operator (-x) has been applied. For example, -----x is parsed as -- -- -x, and since the decrement operator is applied to -x, compilation fails.

In the second code, 0 <---- x is the same as -- --x > 0, and since the decrement operator is applied twice, the value of x decreases by 2 at a time.

When the initial value of x and the length of the arrow in the code above are changed, try to predict how many numbers will be printed.

Input

The first line contains an integer X, the initial value of the variable x, and an integer N, the length of the arrow (-100 ≤ X ≤ 100, 0 ≤ N ≤ 10).

Output

On the first line, print the result of running the program.

  • If the program terminates normally, print the number of numbers the program printed.
  • If the program prints infinitely many numbers, print INFINITE.
  • If the program fails to compile due to the conditions given in the statement, print ERROR.

Hint

In the third example, the value of x is always 3, so the program prints 3 infinitely many times.

Examples3

  1. Example 1

    Input
    10 4
    Expected output
    4
  2. Example 2

    Input
    -5 5
    Expected output
    ERROR
  3. Example 3

    Input
    3 0
    Expected output
    INFINITE