Codeforces Global Round 11
E
Xum
Codeforces
2500
原题
← DF →
翻译中…

You have a blackboard and initially only an odd number $x$ is written on it. Your goal is to write the number $1$ on the blackboard.

翻译中…

You may write new numbers on the blackboard with the following two operations.

翻译中…
  • You may take two numbers (not necessarily distinct) already on the blackboard and write their sum on the blackboard. The two numbers you have chosen remain on the blackboard.
  • You may take two numbers (not necessarily distinct) already on the blackboard and write their bitwise XOR on the blackboard. The two numbers you have chosen remain on the blackboard.
翻译中…

Perform a sequence of operations such that at the end the number $1$ is on the blackboard.

翻译中…

Input

翻译中…

The single line of the input contains the odd integer $x$ ($3 \le x \le 999,999$).

翻译中…

Output

翻译中…

Print on the first line the number $q$ of operations you perform. Then $q$ lines should follow, each describing one operation.

翻译中…
  • The "sum" operation is described by the line "$a$ + $b$", where $a, b$ must be integers already present on the blackboard.
  • The "xor" operation is described by the line "$a$ ^ $b$", where $a, b$ must be integers already present on the blackboard.
翻译中…

The operation symbol (+ or ^) must be separated from $a, b$ by a whitespace.

翻译中…

You can perform at most $100,000$ operations (that is, $q\le 100,000$) and all numbers written on the blackboard must be in the range $[0, 5\cdot10^{18}]$. It can be proven that under such restrictions the required sequence of operations exists. You can output any suitable sequence of operations.

翻译中…

样例

Input #1
3
Output #1
5
3 + 3
3 ^ 6
3 + 5
3 + 6
8 ^ 9
InputCopy OutputCopy
Input #2
123
Output #2
10
123 + 123
123 ^ 246
141 + 123
246 + 123
264 ^ 369
121 + 246
367 ^ 369
30 + 30
60 + 60
120 ^ 121
InputCopy OutputCopy
题目信息
题号
1427E
时间限制
2 s
内存限制
256 MB
标签
位运算
构造
数学
矩阵
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。