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