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