#include <bits/stdc++.h>
using namespace std;
int lp[5000500];
long long dp[5000500];
const int mod = 1000000007;
vector<int> pr;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  int t, l, r;
  cin >> t >> l >> r;
  for (int i = 2; i <= r; ++i) {
    if (lp[i] == 0) {
      lp[i] = i;
      pr.push_back(i);
    }
    for (int j = 0; j < pr.size() && pr[j] <= lp[i] && pr[j] * i <= r; ++j)
      lp[i * pr[j]] = pr[j];
  }
  dp[1] = 0;
  for (int i = 2; i <= r; i++) {
    dp[i] = dp[i / lp[i]] + (i * (long long)(lp[i] - 1)) / 2;
  }
  for (int i = 2; i <= r; i++) dp[i] = dp[i] % mod;
  long long tt = 1;
  int ans = 0;
  for (int i = l; i <= r; i++) {
    ans = (ans + dp[i] * tt) % mod;
    tt = (tt * t) % mod;
  }
  cout << ans;
  return 0;
}
