#include <bits/stdc++.h>
using namespace std;
const int nsz = 5e6, inf = 0x3f3f3f3f, mod = 1e9 + 7;
bool p[nsz + 5];
int l, r;
long long a, ans = 0, f[nsz + 5];
vector<long long> pm;
int main() {
  cin >> a >> l >> r;
  fill(f, f + sizeof(f) / sizeof(long long), inf);
  fill(p, p + sizeof(p) / sizeof(bool), 1);
  f[1] = 0;
  for (int i = 2; i <= r; ++i) {
    if (p[i]) {
      f[i] = (i - 1LL) * i / 2 % mod;
      f[i] %= mod;
      pm.push_back(i);
      for (int j = i + i; j <= r; j += i) {
        p[j] = 0;
      }
    }
    for (long long p : pm) {
      if (p * i > r) break;
      f[p * i] = (f[i] + i * p % mod * (p - 1LL) / 2) % mod;
    }
  }
  long long tmp = 1;
  for (int i = l; i <= r; ++i) {
    ans += tmp * f[i] % mod;
    ans %= mod;
    tmp *= a;
    tmp %= mod;
  }
  cout << ans << '\n';
}
