#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int modpow(int b, int e) {
  int a = 1;
  while (e) {
    if (e & 1) a = 1LL * a * b % MOD;
    b = 1LL * b * b % MOD;
    e >>= 1;
  }
  return a;
}
int dp[5000001];
int sieve[5000001];
void precompute() {
  for (int i = 2; i <= 5000000; ++i) {
    if (sieve[i]) continue;
    for (int j = i; j <= 5000000; j += i) {
      if (sieve[j]) continue;
      sieve[j] = i;
    }
  }
  dp[1] = 0;
  for (int i = 2; i <= 5000000; ++i)
    dp[i] = (1LL * i * (sieve[i] - 1) / 2 + dp[i / sieve[i]]) % MOD;
}
void solve() {
  precompute();
  int t, l, r;
  cin >> t >> l >> r;
  int ans = 0;
  for (int i = l; i <= r; ++i)
    ans = (ans + 1LL * modpow(t, i - l) * dp[i]) % MOD;
  cout << ans << '\n';
}
int main() {
  solve();
  return 0;
}
