Execution time limit is 1 second

Runtime memory usage limit is 128 megabytes

Amin can decrease the number $x$ by $k$ units in one operation. If the result turns out to be negative, he will write down the absolute value of the result in $x$. In other words, the operation takes the form: $x=∣x−k∣$.

Hussein named the number $x$ to Amin as the initial one. Determine the smallest value that can be obtained from it by repeating the above operation any number of times.

This is a very difficult task for Amin. Calculate the answer for him.

Two integers $x(0≤x≤10_{18})$ and $k(1≤k≤10_{18})$.

Output the smallest value that can be obtained from $x$.

In the first test, $x=11$. After performing one operation, we get $x=∣11−4∣=7$.

After two operations, $x=∣7−4∣=3$.

After three operations, $x=∣3−4∣=1$, which is the smallest value that $x$ can take.

In the second test, $x=2$. It is also the smallest value that $x$ can take.

Input #1

Answer #1

Input #2

Answer #2

Input #3

Answer #3