/* -*- coding: utf-8 -*-
 *
 * 906.cc:  No.906 Y字グラフ - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MOD = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  ll n;
  scanf("%lld", &n);

  ll m = n - 4, l = (m / 6) % MOD, ans;
  if (m % 6 == 0)
    ans = (l * (l + 1) % MOD * 3 % MOD + 1) % MOD;
  else
    ans = (l * 3 % MOD + m % 6) % MOD * ((l + 1) % MOD) % MOD;

  printf("%lld\n", ans);
  return 0;
}