Hide

Problem C
Evening Out 2

Marika has two integers $A$ and $B$. She wants $A$ to be divisible by $B$. She can pay $1$ coin to increase or decrease $B$ by $1$. What is the minimum number of coins she must pay?

Input

The first and only line contains the integers $A$ and $B$ ($1 \le A, B \le 10^{15}$).

Output

Output a single line with the minimum number of coins Marika must pay.

Explanation of sample 1

In the first example, she can pay $2$ coins to increase $B$ from $5$ to $7$, which $A = 49$ is divisible with.

Sample Input 1 Sample Output 1
49 5
2

Please log in to submit a solution to this problem

Log in