#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long llinf = 1e16 + 10;
const int maxn = 5e6 + 10;
const int maxm = 20;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
long long t, l, r;
long long dp[maxn];
int fac[maxn];
bool prime[maxn];
void init() {
  memset(prime, 0, sizeof(prime));
  for (int i = 2; i < maxn; i++) fac[i] = i;
  for (int i = 2; i < maxn; i++) {
    if (prime[i] == 0) {
      for (int j = 2; i * j < maxn; j++) {
        fac[i * j] = ((fac[i * j]) > (i) ? (i) : (fac[i * j]));
        prime[i * j] = 1;
      }
    }
  }
  for (long long i = 2; i < maxn; i++) {
    if (prime[i])
      dp[i] = (dp[fac[i]] * (i / fac[i]) + dp[i / fac[i]]) % mod;
    else
      dp[i] = (i * (i - 1) / 2) % mod;
  }
}
int main() {
  init();
  while (~scanf("%I64d %I64d %I64d", &t, &l, &r)) {
    long long ans = 0;
    long long k = 1;
    for (int i = l; i <= r; i++) {
      ans = (ans + (k * dp[i]) % mod) % mod;
      k = (k * t) % mod;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
