#include <bits/stdc++.h>
using namespace std;
const double eps = 0.000000000000001;
unsigned long long F[5000010];
int t, l, r;
int main() {
  unsigned int i, j, x;
  F[2] = 1;
  F[1] = 0;
  scanf("%d%d%d", &t, &l, &r);
  for (i = 3; i <= r; i++) {
    F[i] = (1ULL << 62);
  }
  for (i = 2; i <= r; i++) {
    F[i] =
        min((unsigned long long)F[i], (((unsigned long long)i * (i - 1)) >> 1));
    for (j = i, x = 1; j <= r; j += i, x += 1) {
      F[j] = min(
          F[j],
          (unsigned long long)x * F[i] +
              (unsigned long long)(((unsigned long long)(x) * (x - 1)) >> 1));
    }
  }
  unsigned long long ans = 0, mul = 1;
  for (i = r; i >= l; i--) {
    ans = (ans * t + F[i]) % 1000000007;
  }
  printf("%llu\n", (unsigned long long)ans);
  return 0;
}
