#include <bits/stdc++.h>
using namespace std;
long long dd[5 * 1000006], p[5 * 1000006], prime[5 * 1000006];
long long t, l, r, ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  for (int i = 2; i < 5 * 1000006; i++) prime[i] = 0;
  cin >> t >> l >> r;
  for (long long i = 2; i <= r; i++) {
    if (!prime[i])
      for (int j = i; j < 5 * 1000006; j += i)
        if (!prime[j]) prime[j] = i;
    dd[i] = (i * (prime[i] - 1) / 2 + dd[i / prime[i]]) % 1000000007;
  }
  p[l] = 1;
  for (int i = l + 1; i <= r; i++) p[i] = (p[i - 1] * t) % 1000000007;
  for (int i = l; i <= r; i++)
    ans = (ans + dd[i] * p[i] % 1000000007) % 1000000007;
  cout << ans;
  return 0;
}
