Computing a Well-Known Sum
Time limit1sMemory limit1024 MB
Sum f(i)*g(i) for i from 1 to N, where f(i)=N div i and g(i)=i mod M, with N and M up to 1e9, modulo 1e9+7.
- Level
Hard8 of 10
- Topics
- Math, Number theory, Divide and conquer, Implementation
- Solved
- No attempts yet
Problem
Define as the quotient when is divided by , and as the remainder when is divided by .
Find the remainder of the following value modulo .
Input
The first line contains integers and , separated by a space. ()
Output
Print the value of the given expression modulo .