#include <bits/stdc++.h>
using namespace std;
const long long maxinput = 5000007;
long long inf = 1e9 + 7;
long long spf[maxinput];
long long f[maxinput];
long long pre[maxinput];
long long hell = 1e9 + 7;
long long expo(long long base, long long exponent, long long mod) {
  long long ans = 1;
  while (exponent != 0) {
    if ((exponent & 1) == 1) {
      ans = ans * base;
      ans = ans % mod;
    }
    base = base * base;
    base %= mod;
    exponent >>= 1;
  }
  return ans % mod;
}
long long inv(long long x) { return expo(x, hell - 2, hell); }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 1; i < maxinput; i++) spf[i] = i;
  for (long long i = 2; i < maxinput; i++) {
    if (spf[i] == i) {
      for (long long j = i; j < maxinput; j += i) spf[j] = min(spf[j], i);
    }
  }
  f[1] = 0;
  f[2] = 1;
  f[3] = 3;
  for (long long i = 4; i < maxinput; i++)
    f[i] = (i / spf[i]) * ((spf[i] * (spf[i] - 1)) / 2) + f[i / spf[i]],
    f[i] %= hell;
  long long t, l, r;
  cin >> t >> l >> r;
  long long tpow = expo(t, l - 1, hell);
  long long invt = inv(tpow);
  pre[1] = f[1];
  long long powt = t;
  for (long long i = 2; i <= r + 5; i++) {
    pre[i] = (pre[i - 1] + (powt * f[i]) % hell) % hell;
    pre[i] = (pre[i] + hell) % hell;
    powt *= t;
    powt %= hell;
  }
  long long ans = (pre[r] - pre[l - 1]) % hell;
  ans = (ans * invt) % hell;
  ans = (ans + hell) % hell;
  cout << ans << endl;
}
