#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000005;
const int mod = 1e9 + 7;
long long f[maxn];
int t, l, r, prime[2000005], cnt, las[maxn];
bool p[maxn];
int main() {
  scanf("%d%d%d", &t, &l, &r);
  for (int i = (2); i <= (r); ++i) {
    if (!p[i]) prime[++cnt] = i, las[i] = i;
    for (int j = 1, tmp; j <= cnt && (tmp = i * prime[j]) <= r; ++j) {
      p[tmp] = 1, las[tmp] = prime[j];
      if (i % prime[j] == 0) break;
    }
  }
  for (int i = (2); i <= (r); ++i)
    f[i] = 1ll * i * (las[i] - 1) / 2 + f[i / las[i]];
  int ans = 0;
  for (int i = (r); i >= (l); --i) ans = (1ll * ans * t + f[i]) % mod;
  printf("%d\n", ans);
  return 0;
}
