#include <bits/stdc++.h>
using namespace std;
int f[5000005];
const int mod = 1e9 + 7;
int main() {
  int t = 0, l, r;
  r = 5000000;
  f[1] = 0;
  for (int i = 2; i <= r; i++) {
    if (!f[i]) {
      f[i] = i;
      for (int j = 2 * i; j <= r; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
    int o = f[i];
    f[i] = (1LL * f[i / o] + 1LL * (i / o) * ((1LL * o * (o - 1)) / 2)) % mod;
    t = max(t, f[i]);
  }
  cin >> t >> l >> r;
  long long ans = 0, tp = 1;
  for (int i = l; i <= r; i++) {
    ans = (ans + (tp * f[i]) % mod) % mod;
    tp = (tp * t) % mod;
  }
  cout << ans << '\n';
}
