#include <bits/stdc++.h>
using namespace std;
const long N = 5000001;
const long MOD = 1e9 + 7;
long smallest_factor[N];
long f(long i) {
  if (smallest_factor[i] == 1) return ((long long)i * (i - 1) / 2) % MOD;
  long long comparisons =
      ((long long)smallest_factor[i] * (smallest_factor[i] - 1) / 2) % MOD;
  long total_comparisons = ((i / smallest_factor[i]) * comparisons) % MOD;
  return (total_comparisons + f(i / smallest_factor[i])) % MOD;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  long t, l, r;
  cin >> t >> l >> r;
  for (long i = 1; i <= r; ++i) smallest_factor[i] = 1;
  for (long i = 2; i < r / 2 + 1; ++i) {
    if (smallest_factor[i] == 1)
      for (long j = 2 * i; j <= r; j += i)
        if (smallest_factor[j] == 1) smallest_factor[j] = i;
  }
  long long ans = 0;
  long long tp = 1;
  for (long i = l; i <= r; ++i) {
    ans += tp * f(i) % MOD;
    ans %= MOD;
    tp = (tp * t) % MOD;
  }
  cout << ans << endl;
}
