#include <bits/stdc++.h>
using namespace std;
int spf[5000002];
int f[5000002];
void init() {
  spf[0] = spf[1] = 1;
  for (int i = 2; i < 5000002; ++i) {
    if (spf[i] == 0) {
      spf[i] = i;
      long long int start = 1LL * i * i;
      for (long long int j = start; j < 5000002; j += i) {
        if (spf[j] == 0) spf[j] = i;
      }
    }
  }
  f[0] = f[1] = 0;
  for (int i = 2; i < 5000002; ++i) {
    int x = spf[i];
    int y = i / x;
    long long int val = 1LL * y * x * (x - 1) / 2 + f[y];
    f[i] = val % 1000000007;
  }
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  init();
  int t, l, r;
  cin >> t >> l >> r;
  long long int ans = 0, mul = 1;
  for (int i = 0; i <= r - l; ++i) {
    ans = ans + (mul * f[i + l]) % 1000000007;
    mul = (mul * t) % 1000000007;
  }
  cout << ans % 1000000007 << '\n';
}
