#include using namespace std; typedef long long ll; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) const int mod = 1000007; int main(){ ll N; cin >> N; N %= mod; cout << (N*(N+4)/4)%mod << endl; return 0; }