VFMUL - Very Fast Multiplication


Multiply the given numbers.

Input

n [the number of multiplications <= 101]

l1 l2 [numbers to multiply (at most 300000 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
bnzhaxx: 2017-04-24 23:31:01

And bigInteger is slow slow slow slow slow...

sukanta_27: 2017-04-20 12:59:11

Not even a single person solved this problem in JAVA!!!!

Jared León: 2017-03-21 21:01:12

My first fft problem! AC in 0.78 s.

mat_79: 2016-09-19 15:43:54

Anyone got this in java?

Ayush Mishra: 2016-08-31 10:47:15

Getting TLE on MUL and TMUL and not on VMUL! o.O

square1001: 2016-07-28 10:45:01

I implementated for FFT and I got AC in 0.57s, but I can't calculate 2^2^23 in this code because of "error".

I calculated for Number Theoretic Transform(NTT) and now I am able to calculate 2^2^23!

Last edit: 2016-07-29 02:54:38
algo_aris: 2015-12-08 17:18:08

No chance to do it with Java, I think. Will try in future move it to C++

Alexandru Valeanu: 2015-09-03 12:04:45

Karatsuba with base 10^4 gets AC in 2.49 sec.

Vamsi Krishna Avula: 2015-01-20 11:13:44

solvable in Python :D

Anubhav Balodhi : 2014-07-18 11:50:56

Karatsuba with base 10^9 getting TLE, which was AC with MUL. going to learn FFT, I hope this will test its implementation and not fast I/O.


Added by:Darek Dereniowski
Date:2004-11-27
Time limit:3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6
Resource:PAL