#include <bits/stdc++.h>
using namespace std;
const int N = 5000005, MOD = 1e9 + 7;
long long t, l, r, ans, p = 1, d[N], dp[N];
inline void generateDivs() {
  vector<bool> p(N, true);
  p[0] = p[1] = false;
  for (int i = 1; i < N; ++i) {
    d[i] = i;
  }
  for (int i = 2; i * i < N; ++i) {
    if (!p[i]) continue;
    for (int j = i; j < N; j += i) {
      p[j] = false;
      d[j] = min(d[j], (long long)i);
    }
  }
}
long long f(long long n) {
  if (n < 2) return 0;
  long long& ret = dp[n];
  if (~ret) return ret;
  long long x = d[n];
  ret = ((n / x) * (x * (x - 1) / 2) % MOD + f(n / x)) % MOD;
  return ret;
}
int main() {
  cin >> t >> l >> r;
  generateDivs();
  memset(dp, -1, sizeof(dp));
  while (l <= r) {
    ans = (ans + p * f(l++)) % MOD;
    p = (p * t) % MOD;
  }
  cout << ans;
  return 0;
}
