#include <bits/stdc++.h>
using namespace std;
int divs[5000006];
void getDivs(int r) {
  int inf = 10000007;
  for (int i = 1; i <= r; i += 2) {
    divs[i] = inf;
    divs[i + 1] = 2;
  }
  int lim = r + 1;
  for (int i = 3; i < lim; i += 2) {
    if (divs[i] < inf) continue;
    for (int j = i; j <= r; j += i) {
      divs[j] = min(divs[j], i);
    }
  }
}
inline long long bigmod(long long a, long long p, long long m) {
  long long res = 1 % m, x = a % m;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
int SNOD(int n) {
  int res = 0;
  int u = sqrt(n);
  for (int i = 1; i <= u; i++) {
    res += (n / i) - i;
  }
  res *= 2;
  res += u;
  return res;
}
long long int f[5000006];
long long int pows[5000006];
void func1(int t, int dif) {
  pows[0] = 1;
  pows[1] = t;
  for (int i = 2; i <= dif; i++) {
    pows[i] = (pows[i - 1] % 1000000007 * t % 1000000007) % 1000000007;
  }
}
int main() {
  long long int t;
  int l, r;
  scanf("%I64d %d %d", &t, &l, &r);
  getDivs(r);
  f[1] = 0;
  f[2] = 1;
  f[3] = 3;
  f[4] = 3;
  f[5] = 10;
  for (long long int i = 5; i <= r; i++) {
    long long int tmp1 = (long long int)divs[i] * (long long int)(divs[i] - 1);
    tmp1 /= 2;
    tmp1 = (tmp1 % 1000000007 * (i / divs[i]) % 1000000007) % 1000000007;
    f[i] = (tmp1 + f[i / divs[i]]) % 1000000007;
  }
  func1(t, r - l + 1);
  int counter = 0;
  long long int ans = 0, tmp1;
  for (int i = l; i <= r; i++) {
    tmp1 = (pows[counter] % 1000000007 * f[i] % 1000000007) % 1000000007;
    counter++;
    ans = (ans + tmp1) % 1000000007;
  }
  printf("%u\n", ans);
}
