Under construction

Still being built. Things may change

A/B - 3

Time limit0.5sMemory limit512 MB

Summary
Given A and B with up to 10000 digits (possibly negative), compute the quotient and nonnegative remainder of A divided by B.
Level

Hard8 of 10

Topics
Math, Implementation, String, Number theory
Solved
No attempts yet

Problem

Write a program that reads two integers A and B and prints the quotient and remainder of A/B.

For integers q and r, if A can be written as A = qB + r (0 ≤ r < |B|), then q is called the quotient and r the remainder.

Input

The first line contains A and B. (-10^10000 ≤ A, B ≤ 10^10000, B ≠ 0)

Output

Print the quotient of A/B on the first line and the remainder on the second line.

Examples5

  1. Example 1

    Input
    5 2
    
    Expected output
    2
    1
    
  2. Example 2

    Input
    7 3
    
    Expected output
    2
    1
    
  3. Example 3

    Input
    7 -3
    
    Expected output
    -2
    1
    
  4. Example 4

    Input
    -7 3
    
    Expected output
    -3
    2
    
  5. Example 5

    Input
    -7 -3
    
    Expected output
    3
    2