#include <bits/stdc++.h>
using namespace std;
long long dp[5000010], f[5000010];
int main() {
  long long t, l, r, i, j, a, b, mod, ans, k = 1, final = 0;
  mod = 1e9 + 7;
  scanf("%lld %lld %lld", &t, &l, &r);
  for (i = 2; i <= r; i++) {
    if (dp[i] == 0) {
      for (j = i; j <= r; j += i)
        if (!dp[j]) dp[j] = i;
    }
    a = dp[i];
    b = i / dp[i];
    if (b == 1)
      f[i] = (i * (i - 1) / 2) % mod;
    else
      f[i] = (b * f[a] + f[b]) % mod;
    if (i >= l) {
      final = (final + k * f[i]) % mod;
      k = (k * t) % mod;
    }
  }
  printf("%lld\n", final);
  return 0;
}
