Sofdor Ali's Magical Blackboard!

TarifEzaz DRMCSC Programming Contes...
Limits 1s, 512 MB

Sofdor Ali found interest in mathematics very early in his life. And now, he wants to spread this interest to every young mind. But the way some of the Bangladeshi schools asks students to memorize the multiplication table disappoints him. “Multiplication is just repeated addition”, Sofdor says to himself and grieves as many young students do not even know this simple fact.

So he decided to open an online website for students named “Magical Blackboard” where they will be shown simple and yet important mathematical logics and puzzles. One of his lessons includes a puzzle where you will be given a number AA, and you have to add it BB times to get the sum. For example, if A=2A = 2 and B=3B = 3, then you need to add AA 3 times and your answer should be 2+2+2=62 + 2 + 2 = 6.

Sofdor Ali has already decided about all the possible values for AA and BB which he will give to his online students. He asked for your help to write a program, that calculates the correct answer for every pair of AA and BB that Sofdor provides to you.


The first line contains an integer TT (1T1051 ≤ T ≤ 10^5), the number of test cases. The next TT lines will contain a pair of AA and BB (1A,B1091 ≤ A,B ≤ 10^9).

For 30 percent of the cases, both AA and BB will be less than or equal to 10410^4.


For every pair of AA and BB, produce the correct result that Sofder expects from his students, on a line by itself.


2 3
10 10
4 5


Login to submit.


92% Solution Ratio
zawad.abdullahEarliest, Jan '16
ApuOrghoFastest, 0.0s
opu_1910018Lightest, 5.4 kB
Nusab19Shortest, 56B
Toph uses cookies. By continuing you agree to our Cookie Policy.