FDIV - Fast Division

no tags 

Given two positive integers A and B, compute the unique Q and R such that A = Q * B + R and 0 <= R < B.  That is, compute the quotient, Q, and the remainder, R, of A divided by B.

Input

The first line contains a single integer T (1 <= T <= 10), indicating the number of test cases.  Each test case contains a single line with A and B separated by a space.  A and B will be positive integers with no more than 10,000 decimal digits with no leading zeroes.

Output

For each test case output a single line containing Q and R separated by a space.

Example

Input:
3
128 10
4320 321
1234567890098765432112345678900987654321 98765432100123456789 Output: 12 8
13 147
12499999887078125001 82208718896223572532

hide comments
[Lakshman]: 2013-05-12 02:14:42

@Amit although its too late there is Little modification in your code and its working fine.
http://ideone.com/F11Vus

Amit: 2013-01-15 13:54:49

I dont know why my code is showing NZEC :(
http://ideone.com/RzsVNu
any help

Last edit: 2013-01-15 13:55:41
Francky: 2013-01-12 11:13:30

It's true for MUL too !
There should have been a selected choice of language.

Mitch Schwartz: 2013-01-11 04:33:27

Trivial Pike solution gets AC in VFDIV.

:D: 2013-01-10 08:31:04

If you can make trivial solutions in some languages the it should be tutorial. Moving it.

abdelkarim: 2013-01-06 08:56:05

by java it is tutorial .

Last edit: 2013-01-06 19:51:46
Mark Gordon: 2013-01-05 23:59:20

The problem is not about getting accepted

(Tjandra Satria Gunawan)(曾毅昆): 2013-01-05 12:50:36

1 line, 71B of python code CAN get Accepted!


Added by:Mark Gordon
Date:2013-01-05
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64