#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e6 + 2;
const long long MOD = 1e9 + 7;
const long long INF = 2e9;
long long dp[MAXN];
long long pwr[MAXN];
int main(int argc, char* argv[]) {
  long long t;
  int l, r;
  scanf("%lld%d%d", &t, &l, &r);
  for (int i = 1; i <= r; i++) {
    dp[i] = (1ll * i * (i - 1)) / 2ll;
  }
  for (long long i = 2; i <= r; i++) {
    for (long long j = 2; i * j <= 1ll * r && j <= i; j++) {
      dp[i * j] = min(dp[i * j], dp[i] + i * ((j * (j - 1)) / 2ll));
      dp[i * j] = min(dp[i * j], dp[j] + j * ((i * (i - 1)) / 2ll));
    }
  }
  long long fans = 0;
  long long pwr = 1;
  for (int i = l; i <= r; i++) {
    if (dp[i] >= MOD) dp[i] %= MOD;
    long long temp = pwr * dp[i];
    if (temp >= MOD) temp %= MOD;
    fans = fans + temp;
    if (fans >= MOD) fans -= MOD;
    pwr *= t;
    if (pwr >= MOD) pwr %= MOD;
  }
  printf("%lld\n", fans);
  return 0;
}
