The use of the triangle in the New Age practices seems to be very important as it represents the unholy trinity (Satan, the Antichrist and the False Prophet bringing mankind to the New World Order with false/distorted beliefs). The triangle is of primary importance in all Illuminati realms, whether in the ritual ceremonies of the Rosicrucians and Masons or the witchcraft, astrological and black magic practices of other Illuminati followers.
One day you found a class of mysterious patterns. The patterns can be classified into different degrees. A pattern of degree nnconsists of \frac{n(n+1)}{2}2n(n+1) small regular triangles with side length 11, all in the same direction, forming a big triangle. The figure below shows the pattern of degree 33. All small regular triangles are highlighted.
Since the pattern contains many regular triangles, which is very evil and unacceptable, you want to calculate the number of regular triangles formed by vertices in the pattern, so that you can estimate the strength of Illuminati. It is not necessary that each side of regular triangles is parallel to one side of the triangles. The figure below shows two regular triangles formed by vertices in a pattern of degree 33.
Since the answer can be very large, you only need to calculate the number modulo 10^9+7109+7.
Input
The first line contains an integer tt (1 \le t \le 10^61≤t≤106) \text{---}— the number of test cases.
Each of the next tt lines contains an integer nn (1 \le n \le 10^9(1≤n≤109) \text{---}— the degree of the pattern.
Output
For each test case, print an integer in one line \text{---}— the number of regular triangles modulo 10^9+7109+7.
样例输入复制
3 1 2 3
样例输出复制
1 5 15
题目来源
逆元
ll pow_mod(ll a, ll b, ll p) // 快速幂 a的b次方求余p
{
ll ret = 1;
while(b)
{
if(b & 1) ret = (ret * a) % p;
a = (a * a) % p;
b >>= 1;
}
return ret;
}
ll getNi(ll x,ll y,ll mod)//x/y %mod
{
return x*pow_mod(y,mod-2,mod)%mod;
}
int main()
{
cout<<getNi(35*24,24,mod);
}
#include <algorithm> //STL通用算法
#include <bitset> //STL位集容器
#include <cctype>
#include <cerrno>
#include <clocale>
#include <cmath>
#include <complex> //复数类
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque> //STL双端队列容器
#include <exception> //异常处理类
#include <fstream>
#include <functional> //STL定义运算函数(代替运算符)
#include <limits>
#include <list> //STL线性列表容器
#include <map> //STL 映射容器
#include <iomanip>
#include <ios> //基本输入/输出支持
#include<iosfwd> //输入/输出系统使用的前置声明
#include <iostream>
#include <istream> //基本输入流
#include <ostream> //基本输出流
#include <queue> //STL队列容器
#include <set> //STL 集合容器
#include <sstream> //基于字符串的流
#include <stack> //STL堆栈容器
#include <stdexcept> //标准异常类
#include <streambuf> //底层输入/输出支持
#include <string> //字符串类
#include <utility> //STL通用模板类
#include <vector> //STL动态数组容器
#include <cwchar>
#include <cwctype>
#define ll long long
using namespace std;
//priority_queue<int,vector<int>,less<int> >q;
int dx[]= {-1,1,0,0,-1,-1,1,1};
int dy[]= {0,0,-1,1,-1,1,1,-1};
const int maxn = 1000000+66;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f3f3f3f3fLL;
ll pow_mod(ll a, ll b, ll p) // 快速幂 a的b次方求余p
{
ll ret = 1;
while(b)
{
if(b & 1) ret = (ret * a) % p;
a = (a * a) % p;
b >>= 1;
}
return ret;
}
long long ex_gcd(long long a,long long b,long long &x,long long &y)
{
if(b == 0)
{
x = 1;
y = 0;
return a;
}
long long m = ex_gcd(b,a%b,y,x);
y -= a/b * x;
return m;
}
int main()
{
int t;
scanf("%d",&t);
while (t--)
{
ll n;
scanf("%lld",&n);
ll ans=((n*(n+1)%mod)%mod)*((n+2)*(n+3)%mod)%mod;
ll k=pow_mod(24,1e9+5,mod);
ans=(ll)ans*k%mod;
printf("%lld\n",ans%mod);
}
}