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
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 :)

mill_2611: 2020-05-11 19:18:17

C++ use boost library . Refer below
https://www.geeksforgeeks.org/advanced-c-boost-library/

leverimmy: 2020-05-04 08:52:56

You can use Karatsuba Multiplication for solving this problem. It will be O(n^1.585).

achipu_1672: 2020-02-29 17:45:12

whoever trying to solve this problem, don't use boost library in c++, or Biginteger in java or python here. please learn from the questions and your approaches. don't search for any shortcuts. you won't learn anything if you do.

dejvik: 2020-02-16 22:26:07

what can i do to lower my time limit in c++

nyawriter: 2020-01-03 08:15:26

Isn't it big number?

jopdhiwaala: 2019-12-25 13:50:25

I have done using string but tle :(. O(n^2)

thelast_01: 2019-10-30 06:05:33

Multiplication rule is best for c language very helpful when we multiply large numbers in c language just store the result in a large array.

sanket17: 2019-07-14 09:59:58

3 liner in python

exesharkx: 2019-01-24 18:50:49

Boost Library .,, ac in one go!


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