#include <bits/stdc++.h>
using namespace std;
long long fac[6000006], dp[6000006];
int main() {
  int t, l, r;
  cin >> t >> l >> r;
  for (int i = 2; i < 6000000; i++) {
    for (int j = i * 2; j < 6000000; j += i) {
      if (!fac[j]) fac[j] = i;
    }
  }
  int cnt = 0;
  long long ans = 0;
  dp[1] = 1;
  for (int i = 2; i < 6000000; i++) {
    if (!fac[i])
      dp[i] = ((long long)i * (i - 1)) / 2;
    else
      dp[i] = (i * (fac[i] - 1) / 2 + dp[i / fac[i]]);
    dp[i] %= 1000000007LL;
  }
  long long tt = 1;
  for (int i = l; i <= r; i++) {
    ans += tt * dp[i];
    tt = (t * tt) % 1000000007LL;
    ans %= 1000000007LL;
  }
  printf("%lld", ans);
  return 0;
}
