#44Easy
Division without dividing
Time: 1 s · Memory: 256 MB
- Loops
Statement
You are given two integers and . Find the integer quotient and the remainder of divided by without the division (/) and remainder (%) operators — only with addition and subtraction.
Input format
A single line with two integers and (, , the quotient is at most ).
Output format
A single line with two integers: the quotient and the remainder.
Examples
Input
17 5
Output
3 2
Input
3 7
Output
0 3
Note
Subtract from until becomes less than — a while loop. The number of subtractions is the quotient and what is left is the remainder. In the first example: , three subtractions: the answer is .
