#include <bits/stdc++.h>
using namespace std;
int t, l, r;
int f[5000005], ans[5000005];
const int MOD = 1000000007;
int main() {
  cin >> t >> l >> r;
  int i = 2;
  ans[i] = (i * (i - 1) / 2);
  for (int j = i * 2; j <= 5000000; j += i) {
    if (f[j] == 0) {
      f[j] = j;
    }
    while (f[j] % i == 0) {
      ans[j] =
          (1LL * ans[j] + (1LL * f[j] / i * (1LL * i * (i - 1) / 2)) % MOD) %
          MOD;
      f[j] = f[j] / i;
    }
  }
  for (int i = 3; i <= 2236; i += 2) {
    if (f[i] == 0) {
      ans[i] = (i * (i - 1) / 2);
      for (int j = i * 2; j <= 5000000; j += i) {
        if (f[j] == 0) {
          f[j] = j;
        }
        while (f[j] % i == 0) {
          ans[j] = (1LL * ans[j] +
                    (1LL * f[j] / i * (1LL * i * (i - 1) / 2)) % MOD) %
                   MOD;
          f[j] = f[j] / i;
        }
      }
    }
  }
  int power = 1, Sol = 0;
  for (int i = l; i <= r; ++i) {
    if (ans[i] == 0) ans[i] = (1LL * i * (i - 1) / 2) % MOD;
    if (f[i] > 1) {
      ans[i] = (ans[i] + 1LL * f[i] * (f[i] - 1) / 2) % MOD;
    }
    Sol = (Sol + 1LL * ans[i] * power) % MOD;
    power = (1LL * power * t) % MOD;
  }
  printf("%d", Sol);
  return 0;
}
