OVISLARSUM - Large Sum
Problem Courtesy: Ovishek Paul
Department of CSE, SUST
Sylhet, Bangladesh.
.........................................................................................................
Bodi is a "hotash" programmer. Sometimes he writes some code that takes 2777778 hours!!!
Good programmers said Bodi to become efficient. But Bodi just can't be. So he writes another code of 2777778 hours! which is below -
long long sum = 0; for(long long i = L; i<=R; i++){ sum += i % mod; sum %= (109 + 7); }
where, 1 <= L <= R <= 1018 , 1 <= mod <= 1018
Now Bodi is here to you because Bodi recently have known that you are so efficient!!!
Input
First line will contain 3 integers L, R, and mod.
Output
Just print the final sum.
Example
Input:4 5 6
Output: 9
Input: 4 10 9 Output: 31
hide comments
nathanaxel:
2020-03-18 03:21:13
halo puede |
|
stevenadriang:
2018-11-10 13:57:33
damned mods |
|
aadarsh45:
2018-10-03 21:23:09
mod+mod+mod in everywhere. |
|
dewa251202:
2018-10-03 11:37:46
Nice |
|
vaibhav2303:
2018-10-02 15:54:55
Please check my submission once
|
|
shahadat191:
2018-09-30 11:03:12
Pattern Problem |
Added by: | Nabil |
Date: | 2018-09-18 |
Time limit: | 1s-2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |