#include #include #include using namespace std; typedef long long int ll; ll mod=1e9+7; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n; cin >> n; n-=4; ll ans=0; if(n%6==0){ ll m=n/6; m%=mod; ans+=3*m*m%mod; ans+=3*m%mod; ans++; ans%=mod; } else{ ll m=n/6; m%=mod; ll k=n%6; ans=(3*m+k)%mod*(m+1)%mod; } cout << ans << endl; }