#include <bits/stdc++.h>
using namespace std;
int is_prime[5000010 + 10], primes[5000010 + 10], firstp[5000010 + 10],
    prime_cnt;
void get_primes() {
  memset(is_prime, -1, sizeof(is_prime));
  for (int i = 2; i <= 5000010; i++) {
    if (is_prime[i]) {
      primes[prime_cnt++] = i;
      firstp[i] = i;
    }
    for (int j = 0; j < prime_cnt && primes[j] * i <= 5000010; j++) {
      firstp[i * primes[j]] = primes[j];
      is_prime[i * primes[j]] = 0;
      if (i % primes[j] == 0) break;
    }
  }
}
long long bin[5000010], f[5000010], t, l, r;
int main() {
  get_primes();
  scanf("%I64d %I64d %I64d", &t, &l, &r);
  long long ans = 0, pre = 1;
  for (int i = 2; i < (5000001); i++)
    f[i] = (f[i / firstp[i]] + (1LL * i * (firstp[i] - 1)) / 2 % 1000000007) %
           1000000007;
  for (int i = l; i < (r + 1); i++) {
    ans = (ans + pre * f[i] % 1000000007) % 1000000007;
    pre = pre * t % 1000000007;
  }
  printf("%I64d\n", ans);
}
