TMUL - Not So Fast Multiplication

no tags 

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
Subash Hansdah: 2014-11-13 22:36:25

I am able to run successfully in the ideone.com, but it's giving "Wrong answer" in spoj. Could anybody please suggest.

Một Bạn Trai Giấu Tên: 2014-11-13 22:36:25

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
Một Bạn Trai Giấu Tên: 2014-11-13 22:36:25

java BigInteger isn't fast enough !!!

Mostafa 36a2: 2014-11-13 22:36:25

Oh Boy .. Python takes 11.56 s
but a very simple code !! :))

Martin Betlista ©u¹ka: 2014-11-13 22:36:25

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

:C++:: 2014-11-13 22:36:25

what is runtime error nzec

Enmanuel Jesus Ramirez Salcedo: 2014-11-13 22:36:25

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
Abhishek Ranjan: 2014-11-13 22:36:25

I think the inputs are same as that for the problem MUL


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