#include <bits/stdc++.h>
const int INF = INT_MAX;
using namespace std;
const int mod = 1000000007;
int sieve[5000010 + 1];
void genPrimes() {
  for (int i = 0; i <= 5000010; i++) sieve[i] = i;
  for (int i = 2; i <= 5000010; i++) {
    if (sieve[i] == i) {
      if (i * 1LL * i <= 5000010)
        for (int j = i * i; j <= 5000010; j += i) sieve[j] = min(sieve[j], i);
    }
  }
}
int dp[5000010];
int getans(int x) {
  if (dp[x] != -1) return dp[x];
  int &ans = dp[x];
  if (sieve[x] == x) {
    return (ans = (x * 1LL * (x - 1) / 2) % mod);
  } else {
    int cur = sieve[x];
    int left = x / cur;
    return (
        ans = (((getans(left)) + 0LL + ((((left)*1LL * (getans(cur))) % mod))) %
               mod));
  }
}
int main() {
  int t, l, r;
  memset(dp, -1, sizeof(dp));
  dp[1] = 0;
  genPrimes();
  cin >> t >> l >> r;
  long long xxx = 1;
  long long ans = 0;
  for (int i = l; i <= r; i++) {
    ans = (((ans) + 0LL + ((((xxx)*1LL * (getans(i))) % mod))) % mod);
    xxx = (((xxx)*1LL * (t)) % mod);
  }
  cout << ans << endl;
}
