#include <bits/stdc++.h>
using namespace std;
const int NMAX = 50000001;
vector<int> Prime(NMAX, 0);
vector<bool> notPrime(NMAX, 0);
int l, r, t;
void sieve() {
  notPrime[1] = 1;
  for (int i = 2; i <= r; i++) Prime[i] = i;
  for (int i = 2; (long long)i * i <= r; i++)
    if (!notPrime[i])
      for (int j = (long long)i * i; (long long)j <= r; j += i) {
        Prime[j] = min(i, Prime[j]);
        notPrime[j] = 1;
      }
}
const long long MOD = 1e9 + 7;
int main() {
  scanf("%d %d %d", &t, &l, &r);
  sieve();
  vector<long long> F(r + 1, 0);
  F[1] = 0;
  F[2] = 1;
  for (int i = 3; i <= r; i++) {
    int x = i;
    F[i] = ((long long)i * (i - 1)) / 2;
    while (x != 1) {
      int j = Prime[x];
      while (x % j == 0) x /= j;
      F[i] = min(F[i], F[i / j] + (long long)i * (j - 1) / 2);
    }
  }
  long long ans = 0;
  long long Pow = 1;
  for (int i = l; i <= r; i++) {
    ans += ((F[i] % MOD) * Pow) % MOD;
    ans %= MOD;
    Pow = (Pow * t) % MOD;
  }
  cout << ans << endl;
}
