#include using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; ll mod=1e9+7; int main() { ll N; cin>>N; N-=4; ll R=N%6; ll Q=N/6; Q%=mod; cout<<((3*Q+R)*(Q+1)+(R==0))%mod<