#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
const int N = 5e6 + 20;
const int M = 5e6;
long long pri[N];
long long f[N], g[N];
void init() {
  for (int i = 2; i <= M; i++) f[i] = inf, pri[i] = i;
  for (long long i = 2; i <= M; i++) {
    if (pri[i] == i) {
      for (long long j = i + i; j <= M; j += i) pri[j] = min(i, pri[j]);
    }
  }
  f[1] = 0;
  for (long long i = 2; i <= M; i++) {
    for (long long j = i; j != 1; j /= pri[j]) {
      f[i] = min(f[i], i * (pri[j] - 1) / 2 + f[i / pri[j]]);
    }
  }
}
long long t[N], l, r, T;
int main() {
  memset(f, -1, sizeof(f));
  init();
  scanf("%I64d%I64d%I64d", &T, &l, &r);
  t[0] = 1;
  for (long long i = 1; i <= M; i++) t[i] = (t[i - 1] * T) % mod;
  long long ans = 0;
  for (long long i = l; i <= r; i++)
    ans = (ans + (t[i - l] * (f[i] % mod)) % mod) % mod;
  printf("%I64d\n", ans);
  return 0;
}
