Remainders
Hard
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
After Fuad got acquainted with the remainder operator, he thought about the next mathematical problem. He wonders how to compute .
Here represents the remainder operator and represents the remainder obtained when is divided by . For example .
Find the value of the above expression for the given positive integers and .
Input
Two integers and .
Output
Print the value of the given expression.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 2K
Acceptance rate 7%