Statement
양의 정수 이 주어진다. 다음 값을 으로 나눈 나머지를 구하여라.
단, 은 로 정의한다.
Input
입력은 다음과 같은 형식으로 주어진다.
Output
첫 줄에 문제의 답을 출력한다.
Constraints
- .
- .
Subtasks
Samples
Sample 1
Input
2 4
Output
6
When , the only possible pair is , and the inner sum is for every . Therefore, the answer is .
Sample 2
Input
659824 2350
Output
585035637