#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 5 * 1e6;
vector<char> is_prime(maxn + 1, true);
vector<int> min_div(maxn + 1, -1);
vector<int> f(maxn + 1);
void fill_primes() {
  f[1] = 0;
  for (int i = 2; i <= maxn; ++i) {
    if (!is_prime[i]) {
      goto fill_f;
    }
    min_div[i] = i;
    if (maxn / i >= i) {
      for (long long j = 1ll * i * i; j <= maxn; j += i) {
        if (min_div[j] == -1) {
          min_div[j] = i;
          is_prime[j] = false;
        }
      }
    }
  fill_f:
    int md = min_div[i];
    f[i] = (f[i / md] + 1ll * i * (md - 1) / 2) % mod;
  }
}
int main() {
  fill_primes();
  int t, l, r;
  cin >> t >> l >> r;
  long long tt = 1;
  long long ans = 0;
  for (int i = l; i <= r; ++i) {
    ans = (ans + tt * f[i]) % mod;
    tt = (tt * t) % mod;
  }
  cout << ans << endl;
}
