Ninja always uses his calculator for doing addition, subtraction, multiplication, and division but due to some technical fault in his calculator only the β+β operator is working and all other operators are not in working condition.
Now his teacher gives him the question of subtraction, multiplication, and division, and now ninja is thinking of the solution of these questions by using the β+β operator as only the β+β operator is in working condition.
So help our ninja to do the subtraction, division, and multiplication with the help of addition.
So your task is to write a code that can do subtraction, multiplication, and division, and you are allowed to use only the β+β operator or we can say addition.
Input Format :
The first line of input contains the βTβ number of test cases.
The first line of each test case contains two integers βNβ and βMβ.
Output Format :
For each test case print all three results subtraction result, multiplication result, division result respectively in form of a vector.
Note:
You do not need to print anything; it has already been taken care of. Just implement the function.
Constraints :
1 <= T <= 100
-1000 <= N <= 1000
-1000 <= M <= 1000 and M != 0
Time Limit: 1 sec
2
8 2
16 4
6 16 4
12 64 4
Test Case 1:
In the first line, there is the number of test cases i.e., 2, and in the next lineβ8βand β2βis the integer on which operations are to be performed.
So after operations like after subtraction by using addition we get β16-4=12β, after multiplication by using addition we get β16*4=64β, after division by using addition we get β16/4=4β.
Test Case 2:
For this test case integers are β16β and β4β.
So after operations like after subtraction by using addition we get β8-2=6β, after multiplication by using addition we get β8*2=16β, after division by using addition we get 8/2=4.
2
4 -2
9 -3
6 -8 -2
12 -27 -3
O(min(N, M)), where N and M are the integers on which operations are to be performed,
As during multiplication, our loop will run-up to the minimum of two integer times and during division also for flipping the sign.
O(1).
As we are using constant space.