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