INOUTEST - Enormous Input and Output Test

no tags 

Similar to that of the problem Enormous Input Test, the purpose of this problem is to determine whether your method of reading input data and writing output data is fast enough to process extremely large test cases.

Input

The first line of input contains a single integer N (1 ≤ N ≤ 106), denoting the number of lines to follow. Each of these lines contains two space-separated integers a and b (|a|, |b| ≤ 40,000).

Output

For each pair a and b, write a single line of output containing the value of a × b.

Example

Input:
5
-1 -1
1 1
0 999
654 321
39999 -39999

Output:
1
1
0
209934
-1599920001

hide comments
Neal Wu: 2018-12-20 08:51:38

Time limit has been decreased (from 4.2s to 2s).

mhto: 2017-02-25 06:30:24

0.06 ;p with getchar_unlocked and putchar_unclocked

kass_97: 2017-01-16 19:05:36

Easy one....0.30 sec :D

binari: 2016-08-02 23:35:49

ac with c++ 4.3 in 3.34s
edit: whoa got 0.40s in C (gcc 5.1)

Last edit: 2016-08-02 23:38:52
square1001: 2016-07-30 02:26:48

I used getchar_unlocked() and puthar_unlocked(), so I got 0.07s!

kamran siddique: 2016-04-08 11:09:44

ios_base::sync_with_stdio(0) :)

karthik1997: 2015-07-15 05:56:11

use int for n,a,b and long long int for output and print new line if and only if n!=0 conndition in the loop

Samil Vargas: 2013-12-12 16:34:48

maybe Karatsuba Algorithm could be usefull for this problem

Francky: 2013-12-03 00:18:04

@Deepak : take a look at :
#12 2013-03-18 20:18:26 blabla accepted 15.49 5.0M PYTH 2.7

Deepak: 2013-12-03 00:06:50

Is it even possible in python 2.7 without psyco?

Last edit: 2013-12-03 00:07:04

Added by:Neal Wu
Date:2008-11-30
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO