#include using namespace std; const unsigned long long MOD=1e9+7; int main(){ unsigned long long n,ans=0; cin>>n; for(int i=0;in)break; unsigned long long m=k*2; unsigned long long numblock=(3*k-1)*k/2; unsigned long long last_num_b= ((n-k)/m) *m +k; unsigned long long last_num_e= last_num_b+k-1; unsigned long long blocks=(last_num_b-k)/m+1; ans+=((numblock+numblock+(blocks-1)*m*k)%MOD)*(blocks%MOD)/2; ans%=MOD; if(last_num_e>n){ ans-=(n+1+last_num_e)*(last_num_e-n)/2; ans%=MOD; } cout << "i=" << i << endl; cout << "k=" << k << endl; cout << "m=" << m << endl; cout << "numblock=" << numblock << endl; cout << "last block begins at: " << last_num_b << endl; cout << "last block ends at: " << last_num_e << endl; cout << "there are " << blocks << " blocks" << endl; cout << "the ans is " << ans << endl << endl; ans%=MOD; } cout << ans%MOD << endl; return 0; }