MUL - Fast Multiplication


Multiply the given numbers.

Input

n [the number of multiplications <= 1000]

l1 l2 [numbers to multiply (at most 10000 decimal digits each)]

Text grouped in [ ] does not appear in the input file.

Output

The results of multiplications.

Example

Input:
5
4 2
123 43
324 342
0 12
9999 12345

Output:
8
5289
110808
0
123437655

Warning: large Input/Output data, be careful with certain languages


hide comments
neeraj745: 2022-07-17 07:05:42

Solved in nlog(n) using fast fourier transform...

ayon_suchok37: 2021-05-16 07:06:28

Time Limit Exceeded even if I use string multiplication method. So what is the worst case number here? Can anyone help? Can the problem be solved with the recursion method?

rohit3345ks: 2020-12-08 09:35:22

What size is required in boost to solve this question?

aejaz_ahmed9: 2020-09-30 17:44:10

java users try to input numbers as strings and then make a biginteger variable with the help of "new" and pass that string as argument to the constructor

ayushranjan26: 2020-08-29 19:57:02

where can i find the solution to this question

sohelr360: 2020-07-20 12:01:45

In python it is really easy. but in c++ it is little bit complicated.

ummihopes: 2020-07-20 07:30:13

What does this statement actually mean? "Text grouped in [] does not appear in input file"

raj_304590: 2020-06-16 06:08:21

i used boost library .why it showing wrong answer? can anyone plz tell me.

sk7175: 2020-06-03 22:36:33

runtime error in C progtamming segmentation fault?

wowthecoder: 2020-05-17 06:56:54

For Java users, remember to use BufferedReader and StringTokenizer instead of Scanner because Scanner is too slow. Scanner gave me TLE while BufferedReader is accepted :)


Added by:Darek Dereniowski
Date:2004-06-01
Time limit:1.649s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:PAL