#include <bits/stdc++.h>
using namespace std;
long long int t;
int l, r;
long long int t_pow[5000500], f[5000500], f_full[5000500];
int is_prime[5000500];
void init() {
  for (int i = 0; i < 5000500; i++) {
    f[i] = 0;
    f_full[i] = (long long int)i;
    is_prime[i] = 1;
  }
}
void init_t() {
  t_pow[0] = 1;
  for (int i = 1; i <= r - l; i++) {
    t_pow[i] = t_pow[i - 1] * t;
    t_pow[i] %= 1000000007;
  }
}
void init_f() {
  for (int i = 2; i <= r; i++) {
    if (is_prime[i] == 1) {
      int k = 2;
      f[i] = (long long int)i * (long long int)(i - 1) / 2;
      f[i] %= 1000000007;
      f_full[i] = 1;
      while (i * k <= r) {
        int temp = i * k;
        k++;
        is_prime[temp] = 0;
        while (f_full[temp] % (long long int)i == 0) {
          f_full[temp] /= (long long int)i;
          f[temp] += (((f_full[temp]) *
                       (((long long int)i * (long long int)(i - 1) / 2) %
                        1000000007)) %
                      1000000007);
          f[temp] %= 1000000007;
        }
      }
    }
  }
}
int main() {
  scanf("%lld%d%d", &t, &l, &r);
  init();
  init_t();
  init_f();
  long long int ans = 0;
  for (int i = 0; i <= r - l; i++) {
    ans = ans + t_pow[i] * f[l + i];
    ans %= 1000000007;
  }
  printf("%I64d\n", ans);
}
