A Plus Equals B
Time limit1sMemory limit1024 MB
Given A and B up to 10^18, output at most 5000 operations of the form A+=A, A+=B, B+=A, or B+=B that make A and B equal.
- Level
Medium6 of 10
- Topics
- Number theory, Math, Greedy
- Solved
- No attempts yet
Problem
is a problem used to test basic knowledge in competitive programming. Here is yet another boring variation of it.
You have two integers, and . You want to make them equal. To do so, you can perform several steps, where each step is one of the following:
- +=
- +=
- +=
- +=
Unfortunately, is a hard problem for us, so you are allowed to make at most 5000 steps.
Input
The first line contains two space-separated integers and . These are the initial values of the variables and .
Output
In the first line, print a single integer (), the number of steps.
In the next lines, print one of the following strings to denote the operation: A+=A, A+=B, B+=A, B+=B.
Any sequence of steps that yields the desired result is judged correct.