Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <stack>
  5. using namespace std;
  6.  
  7. #define MOD 1000000007
  8. #define inv12 83333334
  9.  
  10. int main()
  11. {
  12. freopen("main.in", "r", stdin);
  13. unsigned long long res=0,n,m,a,b,c,d;
  14. cin>>n>>m;
  15. if (n>m) swap(n,m);
  16. res = (((((2*m-n+1)*n)%MOD)*(((n+1)*(n+2))%MOD))%MOD)*inv12;
  17. /*cout<<res%MOD<<endl;
  18. res = 0;
  19. for (int i=1;i<=n;i++){
  20. a = ((n-i+1)*(m-i+1))%MOD;
  21. res += (i*a)%MOD;
  22. }/**/
  23. cout<<res%MOD<<endl;
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement