v 0. Pasted by slipstak2 as cpp at 2015-01-23 05:36:30 MSK and set expiration to never.

Paste will expire never.

  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. typedef long long ll;
  6.  
  7. ll MOD = (ll)1e6 + 7;
  8. ll calc(int n) {
  9.     ll a1 = 1;
  10.     ll d = 1;
  11.     ll Sn =     ((2 * a1 + (d * (n - 1))) * n / 2) % MOD; // количество уголков
  12.     n--;
  13.     ll SnBase = ((2 * a1 + (d * (n - 1))) * n / 2) % MOD; // количество карт в основании
  14.  
  15.     return (2 * Sn + SnBase) % MOD;
  16. }
  17.  
  18. int main() {
  19. #ifdef _DEBUG
  20.     freopen("input.txt","r",stdin);
  21.     freopen("output.txt","w",stdout);
  22. #endif
  23.     ios_base::sync_with_stdio(false);
  24.     int n;
  25.     cin>>n;
  26.     cout<<calc(n)<<endl;
  27. }


Editing is locked.