#include <bits/stdc++.h>
using namespace std;
long long dp[5000005];
int mxd[5000005];
bitset<5000005> prim;
int l, r, t;
long long at = 1, ans = 0;
long long solv() {
  prim.set();
  for (int i = 2; i <= r; i++)
    if (prim[i]) {
      mxd[i] = i;
      for (int j = i + i; j <= r; j += i) {
        if (!mxd[j]) mxd[j] = i;
        prim[j] = 0;
      }
    }
  dp[0] = 0;
  dp[1] = 0;
  dp[2] = 1;
  dp[3] = 3;
  for (int i = 4; i <= r; i++) {
    dp[i] = i * (i - 1LL) / 2LL;
    dp[i] = min(dp[i], dp[i / mxd[i]] + dp[mxd[i]] * (i / mxd[i]));
  }
  for (int i = l; i <= r; i++) {
    ans = (ans + ((at % 1000000007) * (dp[i] % 1000000007)) % 1000000007) %
          1000000007;
    at = (at * t) % 1000000007;
  }
  return ans;
}
int main() {
  scanf("%d%d%d", &t, &l, &r);
  printf("%lld\n", solv());
}
