#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
template <class T>
inline T biton(T n, T pos) {
  return n | ((T)1 << pos);
}
template <class T>
inline T bitoff(T n, T pos) {
  return n & ~((T)1 << pos);
}
template <class T>
inline T ison(T n, T pos) {
  return (bool)(n & ((T)1 << pos));
}
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
inline int nxt() {
  int aaa;
  scanf("%d", &aaa);
  return aaa;
}
inline long long int lxt() {
  long long int aaa;
  scanf("%lld", &aaa);
  return aaa;
}
inline double dxt() {
  double aaa;
  scanf("%lf", &aaa);
  return aaa;
}
template <class T>
inline T bigmod(T p, T e, T m) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
  }
  return (T)ret;
}
int ar[5000010];
long long int dp[5000010];
long long int p[5000010];
int a, b;
long long int ans;
void gen(int n, long long int t) {
  int sq = sqrt(n);
  for (int i = 2; i < sq + 1; i++) {
    if (ar[i] == 0) {
      for (int j = i; j <= n; j += i)
        if (ar[j] == 0) ar[j] = i;
    }
  }
  p[0] = 1;
  p[1] = t;
  int c = 0;
  for (int i = 2; i < b + 1; i++) {
    p[i] = (p[i - 1] * t) % 1000000007;
    long long int x = ar[i];
    if (x == 0) x = i;
    dp[i] =
        dp[i / x] + (((long long int)i / x) * (x * (x - 1)) / 2) % 1000000007;
    dp[i] %= 1000000007;
    if (i >= a) {
      ans += (p[c] * dp[i]) % 1000000007;
      ans %= 1000000007;
      c++;
    }
  }
}
int main() {
  long long int t = lxt();
  a = nxt();
  b = nxt();
  gen(5000010 - 1, t);
  cout << ans << endl;
  return 0;
}
