#include <bits/stdc++.h>
using namespace std;
const long long N = 5e6 + 5;
const long long mod = 1000000007;
long long prime[N];
long long dp[N], x[N];
void seive() {
  memset(prime, -1, sizeof prime);
  for (long long i = 2; i < N; ++i) {
    if (prime[i] == -1) {
      for (long long j = i; j < N; j += i) {
        if (prime[j] == -1) prime[j] = i;
      }
    }
  }
}
void solve() {
  seive();
  long long t, l, r;
  cin >> t >> l >> r;
  dp[0] = dp[1] = 0;
  for (long long i = 2; i <= r; i++) {
    long long j = i;
    long long p = prime[j];
    long long z = ((j / p) % mod * (p * (p - 1) / 2) % mod) % mod;
    dp[i] = (z % mod + dp[j / p] % mod) % mod;
  }
  long long ans = 0;
  x[0] = 1;
  for (long long i = 1; i <= r - l; i++)
    x[i] = (x[i - 1] % mod * t % mod) % mod;
  for (long long i = 0; i <= r - l; i++) {
    long long z = x[i];
    ans = (ans % mod + (z % mod * dp[l + i] % mod) % mod) % mod;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
