#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e6 + 1;
long long d[maxn];
int p[maxn] = {0};
void init() {
  for (long long i = 2; i < maxn; ++i) {
    if (p[i] == 0) {
      for (long long j = i * i; j < maxn; j += i) {
        p[j] = i;
      }
    }
  }
  for (long long i = 2; i < maxn; ++i) {
    if (p[i] == 0) {
      d[i] = i * (i - 1) / 2;
    } else {
      d[i] = 1e18;
      for (int cur = i; p[cur]; cur /= p[cur]) {
        d[i] = min(d[i], d[i / p[cur]] + i * (p[cur] - 1) / 2);
      }
    }
  }
}
const int mod = 1e9 + 7;
int main() {
  init();
  long long t, l, r;
  scanf("%lld %lld %lld", &t, &l, &r);
  long long ret = 0, base = 1;
  for (long long i = l; i <= r; ++i) {
    ret += d[i] % mod * base % mod;
    base = base * t % mod;
  }
  printf("%lld\n", ret % mod);
}
