#include <bits/stdc++.h>
using namespace std;
int a[5000005];
long long f[5000005];
int t, l, r;
vector<long long> fac;
void judgePrime() {
  memset(a, 0, sizeof(a));
  for (int i = 2; i * i <= 5000005; i++) {
    if (!a[i]) {
      fac.push_back(i);
      for (int j = i * i; j < 5000005; j += i) a[j] = 1;
    }
  }
}
int main() {
  judgePrime();
  f[1] = 0;
  for (int i = 2; i < 5000005; i++) {
    if (!a[i])
      f[i] = ((long long)i * (long long)(i - 1) / 2) % 1000000007;
    else {
      long long minFac;
      for (int j = 0; j < fac.size(); j++) {
        if (i % fac[j] == 0) {
          minFac = fac[j];
          break;
        }
      }
      f[i] = (i / minFac * f[minFac] + f[i / minFac]) % 1000000007;
    }
  }
  scanf("%d%d%d", &t, &l, &r);
  long long ans = 0;
  long long temp = 1;
  for (int i = l; i <= r; i++) {
    ans = (ans + temp * f[i]) % 1000000007;
    temp = (temp * t) % 1000000007;
  }
  printf("%I64d\n", ans);
  return 0;
}
