P9736 [COCI 2022/2023 #2] Ekspert

Description

You are given four variables $\texttt{A}$, $\texttt{B}$, $\texttt{C}$, $\texttt{D}$ with initial values $x$, $y$, $0$, $1$. You can perform the following operation on them: Choose two variables, and store their sum into one variable. Please use this operation no more than $100$ times to make the value of at least one variable equal to $x \times y$.

Input Format

One line with two integers $x$, $y$ ($1 \le x \times y \le 10^{18}$), with the meaning as described in the statement.

Output Format

The first line outputs a non-negative integer $n$ ($0 \le n \le 100$), indicating the number of operations. In the next $n$ lines, the $i$-th line records the $i$-th operation in the form $\texttt{R1 R2 R3}$, meaning to store the sum of $\texttt{R1}$ and $\texttt{R2}$ into $\texttt{R3}$.

Explanation/Hint

| $\text{Subtask}$ | Score | Special property | | :-: | :-: | :-: | | $1$ | $14$ | $x, y \le 50$ | | $2$ | $14$ | $x \times y \le 10^4$ | | $3$ | $42$ | None. | **This problem has a full score of $70$ points.** Translated by ChatGPT 5