Files
python/TangDou/Dfs/TD.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

25 lines
476 B
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 1e9 + 7;
// 快速幂
int qmi(int a, int b) {
int res = 1;
while (b) {
if (b & 1) res = (LL)res * a % mod;
a = (LL)a * a % mod;
b >>= 1;
}
return res;
}
int main() {
LL n;
cin >> n;
LL a = (n * (n + 1)) % mod;
a = a * (2 * n + 1) % mod;
a = a * qmi(6, mod - 2) % mod;
cout << a << endl;
return 0;
}