#include <bits/stdc++.h>
using namespace std;
long long t, l, r;
long long f[5000001];
bool prim[5000001];
vector<long long> isprim;
int main() {
  cin >> t >> l >> r;
  for (register long long i = 2; i <= r; i++) prim[i] = 1;
  for (register long long i = 2; i <= r; i++)
    if (prim[i]) {
      isprim.push_back(i);
      f[i] = i * (i - 1) / 2;
      for (int j = i + i; j <= r; j += i) prim[j] = 0;
    }
  long long cnt = 0;
  for (register long long i = 2; i <= r; i++) {
    if (prim[i]) continue;
    f[i] = 1e18;
    for (register int j = 0; j < isprim.size(); j++)
      if (i % isprim[j] == 0) {
        f[i] = min(f[isprim[j]] * (i / isprim[j]) + f[i / isprim[j]],
                   f[i / isprim[j]] * isprim[j] + f[isprim[j]]);
        break;
      }
  }
  long long ans = 0;
  for (register int i = r; i >= l; i--)
    ans = (ans * t + f[i]) % (long long)(1e9 + 7);
  cout << ans << endl;
  return 0;
}
