#include <bits/stdc++.h>
using namespace std;
long long dp[5000005];
void solve() {
  for (long long i = 1; i <= 5000000; i++) dp[i] = i * (i - 1) / 2;
  for (long long i = 2; i <= 5000000 / 2; i++) {
    for (long long j = 2; j <= i; j++) {
      if (i * j > 5000000) break;
      dp[i * j] = min(dp[i * j], dp[i] + j * (j - 1) / 2 * i);
      dp[i * j] = min(dp[i * j], dp[j] + i * (i - 1) / 2 * j);
    }
  }
  long long t, l, r;
  cin >> t >> l >> r;
  long long tt = 1, ans = 0;
  while (l <= r) {
    dp[l] %= (long long)(1e9 + 7);
    ans = (ans + tt * dp[l]) % (long long)(1e9 + 7);
    tt = (tt * t) % (long long)(1e9 + 7);
    l++;
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
