#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e6 + 10;
const int mod = 1e9 + 7;
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
const int iinf = 0x3f3f3f3f;
int l, r;
long long t;
long long f[maxn];
bool notp[maxn];
int prime[maxn];
int cntp;
int minp[maxn];
int main() {
  scanf("%I64d%d%d", &t, &l, &r);
  memset(f, 0x3f, sizeof f);
  f[1] = 0;
  f[2] = 1;
  memset(notp, 0, sizeof notp);
  memset(minp, 0x3f, sizeof minp);
  cntp = 0;
  for (int i = 2; i <= r; i++) {
    if (!notp[i]) {
      prime[cntp++] = i;
    }
    for (int j = 0; j < cntp && prime[j] * i <= r; j++) {
      notp[prime[j] * i] = true;
      minp[prime[j] * i] = min(minp[prime[j] * i], prime[j]);
    }
  }
  for (int i = 3; i <= r; i++) {
    if (notp[i]) {
      f[i] = f[i / minp[i]] + i * 1LL * (minp[i] - 1) / 2 % mod;
      f[i] %= mod;
    } else
      f[i] = i * 1LL * (i - 1) / 2 % mod;
  }
  long long res = 0;
  long long tpow = 1;
  for (int i = 0; i <= r - l; i++) {
    res = (res + tpow * f[l + i] % mod) % mod;
    tpow = tpow * t % mod;
  }
  printf("%I64d\n", res);
}
