#include <bits/stdc++.h>
using namespace std;
const long long m = 1e9 + 7;
vector<long long> powMem(5000001, 0);
vector<long long> fMem(5000001, 0);
vector<int> minDiv(5000001, 0);
long long f(int n) {
  if (fMem[n]) return fMem[n];
  int mDiv = minDiv[n];
  if (mDiv == n) {
    fMem[n] = (1LL * n * (n - 1) / 2) % m;
    return fMem[n];
  }
  if (!fMem[mDiv]) {
    fMem[mDiv] = f(mDiv);
  }
  int groups = n / mDiv;
  fMem[n] = (groups * fMem[mDiv] + f(groups)) % m;
  return fMem[n];
}
long long powMod(int t, int n) {
  if (powMem[n]) return powMem[n];
  long long result = powMod(t, n >> 1);
  result = (result * result) % m;
  if (n & 1) {
    result = (t * result) % m;
  }
  powMem[n] = result;
  return result;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t, l, r;
  cin >> t >> l >> r;
  powMem[0] = 1;
  fMem[2] = 1;
  fMem[3] = 3;
  long long sum = 0;
  for (int i = 2, s = minDiv.size(), root = sqrt(s) + 1; i < s; i++) {
    if (minDiv[i] != 0) continue;
    minDiv[i] = i;
    if (i > root) continue;
    for (int j = i * i; j < s; j += i) {
      if (minDiv[j] == 0) minDiv[j] = i;
    }
  }
  for (int i = 0, diff = r - l; i <= diff; i++) {
    sum += (powMod(t, i) * f(l + i)) % m;
    sum %= m;
  }
  cout << sum << endl;
  return 0;
}
