#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; if(N%6==0){ cout<<(3*(((N/6)%mod)*(N/6+1)%mod)+1)%mod<