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


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

hide comments
2017-04-24 23:31:01
And bigInteger is slow slow slow slow slow...
2017-04-20 12:59:11
Not even a single person solved this problem in JAVA!!!!
2017-03-21 21:01:12 Jared León
My first fft problem! AC in 0.78 s.
2016-09-19 15:43:54
Anyone got this in java?
2016-08-31 10:47:15 Ayush Mishra
Getting TLE on MUL and TMUL and not on VMUL! o.O
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
2015-12-08 17:18:08
No chance to do it with Java, I think. Will try in future move it to C++
2015-09-03 12:04:45 Alexandru Valeanu
Karatsuba with base 10^4 gets AC in 2.49 sec.
2015-01-20 11:13:44 Vamsi Krishna Avula
solvable in Python :D
2014-07-18 11:50:56 Anubhav Balodhi
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.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.