#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<utility>
#include<set>
#include<map>
#include<cctype>
#include<cmath>
#include<algorithm>
using namespace std;

#define RALL(x) (x).rbegin(),(x).rend()
#define ALL(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rev(j,m) for(int j=1;j<=(m);j++)
#define repp(k,l,r) for(int k=0;k<(l);k+=r)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin(); itr!=(c).end(); itr++)
#define pb push_back


typedef long long ll;
typedef pair<int,int> P;
typedef vector<pair<int,int> > pii;
typedef map<string,int> mi;


int main(){
	ll n,a,b;
	cin >> n;
	a=((n+1)/2)%1000007;
	b=(n/2)%1000007;
	cout << ((a+1)*b+a)%1000007 << endl;
	return 0;
}