Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <algorithm>
- #include <stack>
- using namespace std;
- #define MOD 1000000007
- #define inv12 83333334
- int main()
- {
- freopen("main.in", "r", stdin);
- unsigned long long res=0,n,m,a,b,c,d;
- cin>>n>>m;
- if (n>m) swap(n,m);
- res = (((((2*m-n+1)*n)%MOD)*(((n+1)*(n+2))%MOD))%MOD)*inv12;
- /*cout<<res%MOD<<endl;
- res = 0;
- for (int i=1;i<=n;i++){
- a = ((n-i+1)*(m-i+1))%MOD;
- res += (i*a)%MOD;
- }/**/
- cout<<res%MOD<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement