fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. const ll mod=1000000007;
  5. int main(){
  6. ll t;cin>>t;
  7. while(t--){
  8. ll n;cin>>n;
  9. n--;
  10. n%=mod;
  11. ll acro=(n*(n+1))/2;
  12. acro++;
  13. acro%=mod;
  14. cout<<acro<<endl;
  15. }
  16. }
Success #stdin #stdout 0.01s 5432KB
stdin
2
6
4
stdout
16
7