#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int big[5000010], ans[5000010];
long long int ncr(long long int n) {
  long long int x = (((n % mod) * ((n - 1) % mod)) / 2) % mod;
  return x;
}
int main() {
  long long int l, r, t;
  scanf("%lld%lld%lld", &t, &l, &r);
  long long int i, j;
  for (i = r / 2; i > 1; i--) {
    for (j = i * 2; j <= r; j = j + i) {
      if (big[j] == 0) {
        big[j] = i;
      }
    }
  }
  for (i = 2; i <= r; i++) {
    if (big[i] == 0) {
      big[i] = 1;
    }
  }
  ans[1] = 0;
  for (i = 2; i <= r; i++) {
    long long int x = ((big[i]) * (ncr(i / big[i]))) % mod;
    ans[i] = (x + ans[big[i]]) % mod;
  }
  long long int final = 0, k = 1;
  for (i = l; i <= r; i++) {
    final = (final + (k * ans[i]) % mod) % mod;
    k = ((k % mod) * (t % mod)) % mod;
  }
  printf("%lld\n", final % mod);
  return 0;
}
