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