fork download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. #define FOR(i,a,b) for(int i=a; i<=b; i++)
  7. #define MOD 1000000007
  8.  
  9. typedef long long LL;
  10.  
  11. int main()
  12. {
  13. double A,B;
  14. LL a,b;
  15.  
  16. cin>>A>>B;
  17.  
  18. a = ceil(A);
  19. b = floor(B);
  20.  
  21. LL sb = b * (b + 1) / 2 * (2 * b + 1) / 3;
  22. LL sa = a * (a - 1) / 2 * (2 * a - 1) / 3;
  23.  
  24. if (sb < sa)
  25. sb += MOD;
  26.  
  27. cout<<((sb - sa) % MOD)<<endl;
  28.  
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 3416KB
stdin
Standard input is empty
stdout
0