#include <bits/stdc++.h>
using namespace std;
const int N = 5e6 + 1;
const int M = 1e9 + 7;
const double eps = 1e-6;
long long pw(long long a, long long b, long long M) {
  return b ? b & 1 ? a * pw(a, b - 1, M) % M : pw(a * a % M, b >> 1, M) : 1;
}
int t, l, r;
long long f[N], ans, n = 1;
int p[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t >> l >> r;
  for (int i = (2); i <= (r); i++) {
    if (!p[i]) {
      for (int j = i; j <= r; j += i)
        if (!p[j]) p[j] = i;
    }
    long long a = p[i], b = i / p[i];
    if (i == p[i])
      f[i] = 1LL * i * (i - 1) / 2 % M;
    else
      f[i] = f[a] * b + f[b], f[i] %= M;
    if (i >= l) {
      ans = (ans + f[i] * n) % M, n = n * t % M;
    }
  }
  cout << ans << endl;
}
