#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e6 + 5;
const int INF = 2e9 + 1;
const long long MOD = 1e9 + 7;
long long dp[MAXN];
int is_prime[MAXN];
vector<int> prime;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 2; i < MAXN; i++) {
    if (!is_prime[i]) {
      prime.push_back(i);
      for (long long j = 1LL * i * i; j < MAXN; j += i) {
        is_prime[j] = 1;
      }
    }
  }
  long long t;
  int l, r;
  cin >> t >> l >> r;
  for (int i = 2; i <= r; i++) {
    if (!is_prime[i]) {
      dp[i] = 1LL * i * (i - 1) / 2 % MOD;
    } else {
      for (auto j : prime) {
        if (i % j == 0) {
          dp[i] = (dp[i / j] + 1LL * i / j * dp[j]) % MOD;
          break;
        }
      }
    }
  }
  long long x = 1, ans = 0;
  for (int i = l; i <= r; i++) {
    ans = (ans + x * dp[i]) % MOD;
    x = (x * t) % MOD;
  }
  cout << ans << endl;
  return 0;
}
