#include <bits/stdc++.h>
using namespace std;
long long t, l, r, mod = 1e9 + 7, ans = 0;
vector<long long> factor(5000006, -1), dp(5000006, -1);
vector<bool> prime(5000006, true);
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (long long i = 2; i <= 5000000; i++) {
    factor[i] = i;
  }
  for (long long i = 2; i * i <= 5000000; i++) {
    if (prime[i]) {
      for (long long j = i + i; j <= 5000000; j += i) {
        factor[j] = min(factor[j], i);
        prime[j] = false;
      }
    }
  }
  cin >> t >> l >> r;
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = 1;
  dp[3] = 3;
  for (long long i = 4; i <= 5000000; i++) {
    dp[i] = LLONG_MAX;
    if (prime[i]) {
      dp[i] = (i * (i - 1)) / 2;
    } else {
      long long curr = i;
      while (curr != 1) {
        dp[i] = min(dp[i], (i / factor[curr]) * dp[factor[curr]] +
                               dp[i / factor[curr]]);
        curr /= factor[curr];
      }
    }
  }
  long long tt = 1;
  for (long long i = l; i <= r; i++) {
    dp[i] %= mod;
    ans += (tt * dp[i]) % mod;
    tt *= t;
    tt %= mod;
    ans %= mod;
  }
  cout << ans << "\n";
  return 0;
}
