#include <bits/stdc++.h>
using namespace std;
const long long int INF = 0x3f3f3f3f3f3f3f3f;
const long long int MAXN = 5000005;
const long long int mod = 1000000007;
long long int t, l, r;
long long int f[MAXN + 1];
long long int max_prime[MAXN + 1];
bool not_prime[MAXN + 1];
void Init_max_prime() {
  memset(not_prime, 0, sizeof(not_prime));
  for (long long int i = 2; i <= MAXN; i++) {
    if (not_prime[i] == 0) {
      max_prime[i] = i;
      long long int j = 2 * i;
      while (j <= MAXN) {
        max_prime[j] = i;
        not_prime[j] = 1;
        j += i;
      }
    }
  }
}
void Init_f() {
  f[1] = 0;
  f[2] = 1;
  for (long long int i = 3; i <= MAXN; i++) {
    f[i] = (max_prime[i] * f[i / max_prime[i]] +
            max_prime[i] * (max_prime[i] - 1) / 2) %
           mod;
  }
}
void Work() {
  long long int ans = 0;
  long long int k = 1;
  for (long long int i = l; i <= r; i++) {
    ans = (ans + f[i] * k) % mod;
    k = (k * t) % mod;
  }
  cout << ans << endl;
}
int main() {
  scanf("%I64d%I64d%I64d", &t, &l, &r);
  Init_max_prime();
  Init_f();
  Work();
  return 0;
}
