#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, l, r;
  cin >> t >> l >> r;
  long long ans = 0;
  long long s[r + 1];
  for (long long i = 0; i <= r; i++) s[i] = i;
  long long dp[r + 1];
  memset(dp, 0, sizeof dp);
  for (long long i = 2; i * i <= r; i++) {
    if (s[i] == i) {
      for (long long j = i * i; j <= r; j += i) {
        s[j] = min(s[j], i);
      }
    }
  }
  long long cnt = 1;
  for (long long i = 2; i <= r; i++) {
    dp[i] = 1e15;
    for (long long j = i; j != 1; j /= s[j]) {
      dp[i] = min(dp[i], dp[i / s[j]] + ((i * (s[j] - 1)) >> 1));
    }
    if (i >= l) {
      ans = (ans + (cnt * (dp[i] % 1000000007)) % 1000000007) % 1000000007;
      cnt = (cnt * t) % 1000000007;
    }
  }
  cout << ans << '\n';
  return 0;
}
