#include <bits/stdc++.h>
using namespace std;
int sp[5000010];
long long dp[5000010];
int main() {
  int t, l, r;
  scanf("%d", &t);
  ;
  scanf("%d", &l);
  ;
  scanf("%d", &r);
  ;
  int x, y;
  memset(sp, 0, sizeof(sp));
  ;
  for (x = 2; x * x <= r; x++) {
    if (sp[x] != 0) continue;
    for (y = x + x; y <= r; y += x)
      if (sp[y] == 0) sp[y] = x;
  }
  for (x = 2; x <= r; x++)
    if (sp[x] == 0) sp[x] = x;
  long long ans = 0, z = 1;
  dp[1] = 0;
  for (x = 2; x <= r; x++) {
    int fa = sp[x];
    dp[x] = dp[x / fa] + (x / fa) * 1LL * fa * (fa - 1) / 2LL;
    if (x >= l) {
      ans += z * (dp[x] % 1000000007);
      ans %= 1000000007;
      z *= t;
      z %= 1000000007;
    }
  }
  printf("%lld", ans);
}
