#include <bits/stdc++.h>
using namespace std;
template <typename P, typename Q>
ostream& operator<<(ostream& os, pair<P, Q> p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const long long int mod = 1e9 + 7;
  const int N = 5 * 1000000 + 4;
  static long long int fact[N];
  for (int i = 0; i < N; ++i) {
    fact[i] = i;
  }
  for (int i = 2; i < N; ++i) {
    if (fact[i] == i) {
      for (int j = 2; i * j < N; ++j) {
        fact[i * j] = min<long long int>({i, fact[i * j]});
      }
    }
  }
  static long long int z[N];
  for (long long int i = 1; i < N; ++i) {
    z[i] = i * (i - 1) / 2LL;
  }
  for (long long int i = 2; i < N; ++i) {
    for (long long int j = i; 1 < j; j /= fact[j]) {
      z[i] = min(z[i], z[i / fact[j]] + (i * (fact[j] - 1LL) / 2LL));
    }
  }
  long long int t, small, large;
  while (cin >> t >> small >> large) {
    long long int x = 0;
    long long int y = 1;
    for (int i = small; i <= large; ++i) {
      (x += z[i] % mod * y) %= mod;
      (y *= t) %= mod;
    }
    cout << x << endl;
  }
  return 0;
}
