#include <bits/stdc++.h>
using namespace std;
long long sieve[5000001];
void fill() {
  for (long long i = (1); i < (5000001); i++) sieve[i] = (i * (i - 1)) / 2;
  for (long long i = 2; i < 5000001; i++) {
    for (long long j = 2; i * j < 5000001; j++) {
      sieve[i * j] = min(sieve[i * j], ((i * j * (j - 1)) / 2) + sieve[i]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long t, l, r;
  cin >> t >> l >> r;
  fill();
  long long ans = 0;
  long long c = 1;
  for (long long i = (l); i < (r + 1); i++) {
    long long x = ((sieve[i] % 1000000007) * c) % 1000000007;
    c = (c * t) % 1000000007;
    ans = (ans + x) % 1000000007;
  }
  cout << ans << "\n";
}
