#include <bits/stdc++.h>
using namespace std;
vector<long long> p(5000001, 0);
void sieve() {
  p[1] = 1;
  for (long long i = 2; i < 5000001; i++) {
    if (p[i] == 0) {
      p[i] = i;
      for (long long j = i + i; j < 5000001; j += i) {
        if (p[j] == 0) p[j] = i;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  sieve();
  long long t, l, r;
  cin >> t >> l >> r;
  vector<long long> f;
  for (long long i = l; i <= r; i++) {
    long long temp = i;
    long long count = 0;
    while (temp != 1) {
      long long a = p[temp];
      temp = temp / a;
      count = count + ((((a * (a - 1)) / 2) % 1000000007) * temp) % 1000000007;
      count = count % 1000000007;
    }
    f.push_back(count % 1000000007);
  }
  long long sum = 0, tv = 1;
  for (long long i = 0; i < f.size(); i++) {
    sum = sum + ((tv % 1000000007) * (f[i] % 1000000007)) % 1000000007;
    tv = tv * t;
    tv = tv % 1000000007;
    sum = sum % 1000000007;
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
