#include<bits/stdc++.h>
using namespace std;
long long f[5000010],pwr[5000010],mod=1e9+7,t,r,l,ans;
main()
{
int i,j,k;
cin>>t>>l>>r;
pwr[0]=1;
//for(i=1;i<=r-l+1;i++)pwr[i]=(1ll*pwr[i-1]*t)%mod;
for(i=0;i<=r;i++)
f[i]=1e18;
f[1]=0;
for(i=1;i<=r;i++)
{
for(j=2*i,k=2;j<=r;j+=i,k++)
{
f[j]=min(f[j],(1ll*i*(k-1)*k)/2+f[i]);
}
}
ans=0;long long pr=1;
for(i=l;i<=r;i++)
ans=(ans+((f[i])%mod*pr)%mod)%mod,pr=(pr*t)%mod;
cout<<ans<<endl;
}