#include <bits/stdc++.h>
using namespace std;
const long long N = 5000005;
const long long M = 1000000007;
const long double PI = acos(-1);
long long t, l, r;
long long sieve[N + 5], dp[N + 5];
void Sieve() {
  long long i, j;
  for (i = 2; i <= N; i++) sieve[i] = i;
  for (i = 2; i * i <= N; i++)
    if (sieve[i] == i)
      for (j = i * i; j <= N; j += i) sieve[j] = min(i, sieve[j]);
}
void DP() {
  long long i, j;
  for (i = 2; i <= N; i++)
    for (j = i, dp[i] = LLONG_MAX; j != 1; j /= sieve[j])
      dp[i] = min(dp[i], dp[i / sieve[j]] + i * (sieve[j] - 1) / 2);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Sieve();
  DP();
  cin >> t >> l >> r;
  long long pw = 1, i, ans = dp[l] % M;
  for (i = l + 1; i <= r; i++) {
    dp[i] %= M;
    pw = pw * t % M;
    ans = (ans + pw * dp[i] % M) % M;
  }
  cout << ans;
  return 0;
}
