TMUL - Not So 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


Added by:Darek Dereniowski
Date:2004-10-19
Time limit:2.226s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM32-GCC GAWK MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM NODEJS OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 PY_NBC R RACKET RUST CHICKEN SED SQLITE SWIFT UNLAMBDA VB.NET
Resource:Copy of MUL problem with 12s time limit

hide comments
2015-06-01 21:41:41 Vaporeon
I think the extreme cases aren't there in the judge.. :|
2015-05-20 06:06:36 drfgthyjuikjhgftrd
what to do getting wrong answer in c++ but correct in ideone
2014-11-13 22:36:25 /* Nitin Jaiman */
In java even karatsuba is not fast enough
2014-11-13 22:36:25 /* Nitin Jaiman */
why is it giving wrong answer with BigInteger in java
2014-11-13 22:36:25 /* Nitin Jaiman */
@ishita_2015 use try catch to get rid of NZEC put return in catch.
2014-11-13 22:36:25 Anubhav Balodhi
Karatsuba with BigInt, good learning ^_^
2014-11-13 22:36:25 Steven Hans Limantoro
This is the same with MUL
Just use Karatsuba :)
2014-11-13 22:36:25 ponnila
wat does compilation error mean
2014-11-13 22:36:25 light_coder
I'm getting correct answer in my compiler for the above question. But on posting the same code it shows wrong answer..
2014-11-13 22:36:25 arushi
dont know why it is showing runtime error and SIGSEGV???? in my pc my code is working! wat the hell! everything is correct then why???
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.