#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
int prime[5000005];
long long ff[5000005];
ll l,r,t;
void seive(){
for(int i=2;i<5000005;i++)prime[i] = -1;
prime[0]= prime[1] = 0;
for(long i=2;i*i<=5000005;i++){
if(prime[i]==-1){
for(long j= i+i;j<=5000005;j+=i)
if(prime[j]==-1)
prime[j] = i;
}
}
}
void solv(){
ff[1] = 0;
for(long i=2;i<=r;i++){
if(prime[i]!=-1){
ff [i] = ((i/prime[i] * ff[prime[i]])%MOD + ff[i/prime[i]])%MOD;
}
else {
ff[i] = ((i-1) * i /2 )% MOD;}
}
}
int main(){
ll ans = 0,k=1;
cin>>t>>l>>r;
seive();
solv();
for(int i = l;i<=r;i++){
ans = (ans + (k * ff[i]) % MOD) % MOD;
k = (t * k)%MOD;
}
cout<<ans<<endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGxsOwpsbCBNT0QgPSAxMDAwMDAwMDA3OwppbnQgcHJpbWVbNTAwMDAwNV07CmxvbmcgbG9uZyBmZls1MDAwMDA1XTsKbGwgbCxyLHQ7Cgp2b2lkIHNlaXZlKCl7Cglmb3IoaW50IGk9MjtpPDUwMDAwMDU7aSsrKXByaW1lW2ldID0gLTE7CglwcmltZVswXT0gcHJpbWVbMV0gPSAwOwoJZm9yKGxvbmcgaT0yO2kqaTw9NTAwMDAwNTtpKyspewoJCWlmKHByaW1lW2ldPT0tMSl7CgkJCWZvcihsb25nIGo9IGkraTtqPD01MDAwMDA1O2orPWkpCgkJCQlpZihwcmltZVtqXT09LTEpCgkJCQkJcHJpbWVbal0gPSBpOwoJCX0KCX0KfQp2b2lkIHNvbHYoKXsKCWZmWzFdID0gMDsKCWZvcihsb25nIGk9MjtpPD1yO2krKyl7CgkJaWYocHJpbWVbaV0hPS0xKXsKCQkJZmYgW2ldID0gKChpL3ByaW1lW2ldIC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