#include <bits/stdc++.h>
using namespace std;
const int maxn = 5 * 1e6 + 100;
int dv[maxn];
int ans[maxn];
int c2[maxn];
bool isprime[maxn];
void init() {
  memset(isprime, true, sizeof(isprime));
  for (int i = 2; i <= maxn - 1; i++) dv[i] = i;
  for (int i = 2; i * i <= maxn; i++) {
    if (!isprime[i]) continue;
    for (int j = i; j < maxn; j += i) {
      dv[j] = min(dv[j], i);
      if (i != j) isprime[i] = false;
    }
  }
  for (int i = 2; i <= maxn - 1; i++) {
    c2[i] = (((1ll * i * (i - 1))) / 2ll) % 1000000007;
  }
}
void solve() {
  int n, p, m, k, z, y, x, t;
  init();
  ans[1] = 0;
  for (int i = 2; i <= maxn - 1; i++) {
    ans[i] = (((1ll * (i / dv[i]) * c2[dv[i]]) % 1000000007) +
              1ll * ans[i / dv[i]]) %
             1000000007;
  }
  scanf("%d", &t);
  scanf("%d", &x);
  scanf("%d", &y);
  z = 0;
  int ans1 = 0;
  k = 1;
  for (int i = x; i <= y; i++) {
    ans1 = (1ll * ans1 + ((1ll * k * ans[i]) % 1000000007)) % 1000000007;
    k = (1ll * k * t) % 1000000007;
  }
  printf("%d\n", ans1);
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
