题意:在 n * n 的网格,每个格子上存在 行号 * 列号 个怪物,你从 (1, 1) 出发,只能向下和向右走,走到 (n, n) 一路上最多击杀多少怪物。
思路:击杀的怪物最多肯定就是尽可能的往中间部分走(1*1,1*2,2*2,2*3,3*3...),那么找到规律之后就是2*
因为前面要乘2022,直接乘进去化简算就可以了(要去分母)。
/**
* ┏┓ ┏┓+ +
* ┏┛┻━━━┛┻┓ + +
* ┃ ┃
* ┃ ━ ┃ ++ + + +
* ████━████+
* ◥██◤ ◥██◤ +
* ┃ ┻ ┃
* ┃ ┃ + +
* ┗━┓ ┏━┛
* ┃ ┃ + + + +Code is far away from
* ┃ ┃ + bug with the animal protecting
* ┃ ┗━━━┓ 神兽保佑,代码无bug
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛ + + + +
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛+ + + +
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#define sc_int(x) scanf("%d", &x)
#define sc_ll(x) scanf("%lld", &x)
#define pr_ll(x) printf("%lld", x)
#define pr_ll_n(x) printf("%lld\n", x)
#define pr_int_n(x) printf("%d\n", x)
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
ll n, m, h;
void solve()
{
cin >> n;
ll a=(674*(n*((n+1)*(2*n+1)%mod)%mod)%mod);
ll b=(1011*(n*(n+1)%mod)%mod);
cout<<(a-b+mod)%mod<<endl;
return;
}
int main()
{
int t;
sc_int(t);
while (t--)
solve();
return 0;
}