#include <bits/stdc++.h>
using namespace std;
const int N = 5e6 + 5;
const int M = 1e9 + 7;
int sp[N];
int po[N];
long long dp[N];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t, l, r;
  cin >> t >> l >> r;
  for (int i = 2; i <= r; ++i) {
    for (int j = i; j <= r; j += i) {
      if (!sp[j]) {
        sp[j] = i;
      }
    }
  }
  for (int i = 2; i <= r; ++i) {
    dp[i] = 1ll * i * (i - 1) / 2;
    dp[i] = min(dp[i], i / sp[i] * dp[sp[i]] + dp[i / sp[i]]);
  }
  int res = 0;
  for (int i = l, j = 1; i <= r; ++i) {
    dp[i] %= M;
    res += j * dp[i] % M;
    res %= M;
    j = 1ll * j * t % M;
  }
  cout << res;
}
