#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 5e6 + 5;
int main() {
  vector<int> p;
  bool composite[MAX];
  for (int i = 0; i < MAX; i++) composite[i] = 0;
  for (int i = 2; i < MAX; i++) {
    if (composite[i]) continue;
    for (int j = 2; i * j < MAX; j++) composite[i * j] = 1;
    p.emplace_back(i);
  }
  int t, l, r;
  cin >> t >> l >> r;
  long long ans = 0;
  long long prod = 1;
  for (int i = l; i <= r; i++) {
    long long v = 0;
    long long temp = i;
    int j = 0;
    while (j < p.size() and composite[temp]) {
      if (temp % p[j] == 0) {
        v += (temp * p[j] - temp) / 2;
        temp /= p[j];
      } else
        j++;
    }
    v += (temp - 1) * temp / 2;
    v %= MOD;
    ans = (ans + (prod * v) % MOD) % MOD;
    prod = (prod * t) % MOD;
  }
  cout << ans;
}
