#include <bits/stdc++.h>
using namespace std;
long long int check[5000005];
long long int t, l, r;
long long int f[5000005];
void sieve() {
  long long int i, j;
  for (i = 0; i <= 5000005 - 1; i++) check[i] = i;
  for (i = 2; i * i < 5000005; i++) {
    if (check[i] == i) {
      for (j = i * i; j < 5000005; j += i) {
        check[j] = min(i, check[j]);
      }
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k;
  sieve();
  cin >> t >> l >> r;
  f[1] = 0;
  for (i = 2; i <= r; i++) {
    long long int mm = LLONG_MAX;
    for (j = i; j != 1; j /= check[j]) {
      mm = min(mm, f[i / check[j]] + (i * (check[j] - 1)) / 2);
    }
    f[i] = mm % 1000000007;
  }
  long long int temp = 1;
  long long int ans = 0;
  for (i = l; i <= r; i++) {
    ans = (ans + ((f[i] * temp) % 1000000007)) % 1000000007;
    temp = (temp * t) % 1000000007;
  }
  cout << ans << endl;
}
