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
2014-11-13 22:36:25 Subash Hansdah
I am able to run successfully in the ideone.com, but it's giving "Wrong answer" in spoj. Could anybody please suggest.
2014-11-13 22:36:25 Một Bạn Trai Giấu Tên
i found this, but haven't tried it myself :D
http://en.wikipedia.org/wiki/Karatsuba_algorithm

Last edit: 2012-11-04 04:39:24
2014-11-13 22:36:25 Một Bạn Trai Giấu Tên
java BigInteger isn't fast enough !!!
2014-11-13 22:36:25 Mostafa 36a2
Oh Boy .. Python takes 11.56 s
but a very simple code !! :))
2014-11-13 22:36:25 Martin Betlista ©u¹ka
When I tried to submit solution with BigInteger I got NZES runtime error too, this one have to be solved differently, time limit is big enough for Java too ;-)
2014-11-13 22:36:25 :C++:
what is runtime error nzec
2014-11-13 22:36:25 Enmanuel Jesus Ramirez Salcedo
im always getting the Runtime error -.-

this is my code for c#

[code was here]

Edit by kokosek:
1. Don't post any source code here.
That's what forum was made.

Last edit: 2011-04-07 03:11:54
2014-11-13 22:36:25 Abhishek Ranjan
I think the inputs are same as that for the problem MUL
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.