#include <bits/stdc++.h>
using namespace std;
long long fast_power(long long val, long long deg, long long mod = 1000000007) {
  if (!deg) return 1 % mod;
  if (deg & 1) return fast_power(val, deg - 1, mod) * val % mod;
  long long res = fast_power(val, deg >> 1, mod);
  return (res * res) % mod;
}
long long MMI(long long a, long long mm = 1000000007) {
  return fast_power(a % mm, mm - 2, mm) % mm;
}
long long arr[5000010];
long long pf[5000010];
void seive(long long n) {
  pf[1] = 1;
  for (long long i = 2; i <= n; i++) {
    arr[i] = 9223372036854775807;
    if (!pf[i]) {
      for (long long j = i; j <= n; j += i)
        if (!pf[j]) pf[j] = i;
    }
  }
}
long long recur(long long n) {
  if (arr[n] != 9223372036854775807) return arr[n];
  long long p = n;
  while (p != 1) {
    arr[n] =
        min(arr[n], recur(n / pf[p]) * (pf[p]) + (pf[p] * (pf[p] - 1)) / 2);
    p /= pf[p];
  }
  return arr[n];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, l, r;
  cin >> t >> l >> r;
  arr[1] = 0;
  seive(5000000);
  long long ans = 0;
  long long T = 1;
  for (long long i = l; i <= r; i++) {
    ans = (ans + (T * (recur(i) % 1000000007)) % 1000000007) % 1000000007;
    T = (T * t) % 1000000007;
  }
  cout << ans;
  return 0;
}
