While the CS nerd is preparing for various computing competitions, the girl approaches him! She gives him some calculus homework and asks him to
do it for her help her complete it. Not wanting to waste a valuable opportunity, the CS nerd agrees to help.
The girl takes out a large stapled package of paper with many simple calculus problems. Her task is to take the derivative of each equation on the sheet.
Each equation is in the form
y = ax^b, where ~a~ and ~b~ are given integers. The derivative of this equation (more accurately, the derivative of ~y~ with respect to ~x~) is
y' = abx^(b-1). The derivative should also be as simplified as possible. In particular, all these rules must be satisfied:
0x^nshould be simplified to
kx^0should be simplified to
1x^nwhere ~n \ne 0, 1~ should be simplified to
-1x^nwhere ~n \ne 0, 1~ should be simplified to
kx^1where ~k \ne 0, 1, -1~ should be simplified to
1x^1should be simplified to
-1x^1should be simplified to
kx^-nwhere ~n > 0~ should not be in fraction form (i.e. it should not be
A given equation may be in its simplified form as described above.
There are ~T~ problems on the worksheet. Can you help the CS nerd finish this tedious homework?
The first line will contain a single integer, ~T~ ~(1 \le T \le 10^5)~, the number of problems.
The next ~T~ lines of input each contain an equation in the form
y = ax^b, which could be in a more simplified form, but not completely simplified. It is guaranteed that ~|ab| \le 10^9~ and ~-10^9 \le a, b \le 10^9~.
For each of the ~T~ equations, output the derivative on a separate line.
7 y = x^5 y = 2x^2 y = 100 y = -3x^-2 y = 5x y = -x^10 y = 0x^0
y' = 5x^4 y' = 4x y' = 0 y' = 6x^-3 y' = 5 y' = -10x^9 y' = 0