#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
int qread() {
  int w = 1, c, ret;
  while ((c = getchar()) > '9' || c < '0') w = (c == '-' ? -1 : 1);
  ret = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + c - '0';
  return ret * w;
}
const int MAXN = 5e6 + 3, MAXM = 5e5 + 3, MOD = 1e9 + 7;
int t, l, r, m, M1[MAXN], M2[MAXN], *A, *B, x = 1, ans;
bool V[MAXM];
int P[MAXM], n;
int main() {
  t = qread(), l = qread(), r = qread();
  A = M1 - l, B = M2 - l, m = sqrt(r) + 1;
  for (int i = 2; i <= m; i++) {
    if (V[i]) continue;
    P[++n] = i;
    for (int j = 2; j <= m / i; j++) V[i * j] = true;
  }
  for (int i = l; i <= r; i++) B[i] = i;
  for (int i = 1; i <= n; i++) {
    long long p = P[i];
    while (p <= r) {
      int a = (l - 1) / p + 1, b = r / p;
      for (int j = a; j <= b; j++)
        A[p * j] =
            ((long long)A[p * j] + (long long)B[p * j] * (P[i] - 1) / 2) % MOD,
              B[p * j] /= P[i];
      p *= P[i];
    }
  }
  for (int i = l; i <= r; i++)
    A[i] = ((long long)A[i] + (long long)B[i] * (B[i] - 1) / 2) % MOD;
  for (int i = l; i <= r; i++)
    ans = ((long long)ans + (long long)x * A[i]) % MOD,
    x = ((long long)x * t) % MOD;
  printf("%d\n", ans);
  return 0;
}
