#include <bits/stdc++.h>
using namespace std;
const unsigned long long int M = 7e6, Q = 1e9 + 7;
unsigned long long int t = 0, l = 0, r = 0, f[M + 2], p = 1, x = 0, k = 0,
                       sum = 0, ma[M + 5], m = 0, o[M + 5];
int main() {
  cin >> t >> l >> r;
  fill(ma, ma + M + 5, 0);
  fill(o, o + M + 5, 0);
  for (unsigned long long int i = 1; i <= r; i++) {
    f[i] = i * (i - 1) / 2;
  }
  for (unsigned long long int i = 2; i <= r; i++) {
    if (ma[i] == 0) {
      for (unsigned long long int j = 2 * i; j <= r; j += i) {
        if (ma[j] == 0) ma[j] = i;
      }
    } else {
      m = i / ma[i];
      k = ma[i];
      x = k * (k - 1) / 2;
      x *= m;
      x += f[m];
      if (x < f[i]) f[i] = x;
    }
    if (i >= l) {
      x = f[i];
      x %= Q;
      x = (p * x) % Q;
      x += 100 * Q;
      x %= Q;
      p = (t * p) % Q;
      sum = (sum + x) % Q;
    }
  }
  cout << sum;
}
