Absolute difference
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Amin can decrease the number by units in one operation. If the result turns out to be negative, he will write down the absolute value of the result in . In other words, the operation takes the form: .
Hussein named the number 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.
Input
Two integers and .
Output
Output the smallest value that can be obtained from .
Examples
In the first test, . After performing one operation, we get .
After two operations, .
After three operations, , which is the smallest value that can take.
In the second test, . It is also the smallest value that can take.
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 623
Acceptance rate 45%