#include using namespace std; signed main(){ int N; cin >> N; N %= ( int ) 1e6 + 7; cout << ( 1LL * N * N / 4 + N ) % ( int ) 1e6 + 7 << endl; return 0; }