#include <bits/stdc++.h>
using namespace std;
void addmod(int &a, long long b) {
  a = (a + b);
  if (a >= 1000000007) a -= 1000000007;
}
void mulmod(int &a, long long b) { a = (a * b) % 1000000007; }
template <class T>
bool domin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool domax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
int gi() {
  int a;
  scanf("%d", &a);
  return a;
}
long long gll() {
  long long a;
  scanf("%lld", &a);
  return a;
}
bool prime[5000007];
int ans[5000007];
vector<int> pn;
vector<long long> cm;
void sieve() {
  memset(prime, true, sizeof(prime));
  pn.clear();
  prime[0] = prime[1] = false;
  for (int i = 2; i * i <= 5000007; i++)
    if (prime[i]) {
      for (int j = i * i; j < 5000007; j += i) prime[j] = false;
    }
  for (long long i = 2; i < 5000007; i++) {
    if (prime[i]) {
      ans[i] = ((i * (i - 1)) / 2) % 1000000007;
      pn.push_back(i);
      cm.push_back(ans[i]);
    }
    for (int j = 0; j < pn.size() && i * pn[j] <= 5000007; j++) {
      int vj = i * pn[j];
      ans[vj] = (i * cm[j]) % 1000000007;
      addmod(ans[vj], ans[i]);
    }
  }
}
int main() {
  sieve();
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  long long t = gi(), l = gi(), r = gi();
  long long tt = 1;
  long long tans = 0;
  for (long long i = l; i <= r; i++) {
    long long v = (tt * ans[i]) % 1000000007;
    tans = (tans + v) % 1000000007;
    tt = (tt * t) % 1000000007;
  }
  cout << tans << endl;
  return 0;
}
