#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9 + 7;
const int n = 1e6;
int a[n];

int main() {
	for(int i = 0; i < n; i++) {
		a[i] = rand() % mod;
	}
	int s = 0;
	for(int rep = 0; rep < 50123; ++rep) {
		a[rand()%n] = rand() % mod;
		int start = rand() % n;
		s += a[start];
		for(int j = start; j < min(n, start + 9000); j++) {
			// s = (s + a[j] < mod ? s+a[j] : s+a[j]-mod);
			s = (s + a[j]) % mod;
		}
	}
	cout << s << endl;
}