You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
404 B

#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
typedef long long LL;
/*
3 5 4
36
*/
int main() {
LL n, m, k;
cin >> n >> m >> k;
// k=4 m=5
LL a = ((k - 1) * (m - k + 1)) % MOD;
// LL b = 0;
// for (LL i = 1; i <= n; i++) b = (b + i) % MOD;
LL b = (n * (n + 1) / 2) % MOD;
cout << (a * b) % MOD << endl;
return 0;
}