CSES - Datatähti Open 2017 - Program
  • Time limit: 0.50 s
  • Memory limit: 512 MB

Uolevi has developed a new programming language, that only contains one variable XX. Initially, the value of XX is 11. In addition, there are three commands:

  • ADD: increase XX by 3
  • MUL: multiply XX by 2
  • END: print XX and stop the program

Your task is to find the shortest program that prints a given number nn, or state that no such program exists.

Input

The only input line contains an integer nn.

Output

If a program exists, you should first output the number of commands in it, and after that, each command in a separate line. If there are several possible programs, you can output any of them.

If a program doesn't exist, you should only print 00.

Example 1

Input:

10

Output:

4
MUL
ADD
MUL
END

Example 2

Input:

12

Output:

0

Subtask 1 (21 points)

  • 1n1001 \le n \le 100

Subtask 2 (37 points)

  • 1n1061 \le n \le 10^6

Subtask 3 (42 points)

  • 1n10181 \le n \le 10^{18}