How to compute this sum? I want to sum the following:

$$f(n) = \sum_{i=1}^n (i^3 \cdot (n \mod i))$$

Since the sum can be huge I have to output the sum modulo some given number m.
How can I approach this problem?

Also, n can be upto $10^{10}$.
As Duplicate question of this has been deleted, I am posting the snapshot of answer posted there.
As Duplicate question of this has been deleted, I am posting the snapshot of answer posted there.