#include <bits/stdc++.h>   using namespace std;   const int inf = 1000000000;   long long mod = 1000000007LL;   long long mod2 = 998244353LL;   long long t, l, r;   long long dp[5000005];   long long prm[5000005];   long long pw[5000005];   long long dfs(int x) {     if (dp[x] >= 0) return dp[x];     if (x == 1) return dp[x] = 0LL;     dp[x] = (long long)x * (long long)(x - 1) / 2LL;     dp[x] %= mod;     long long i;     if (x > 2 && x % 2 == 0) {       return dp[x] = (dfs(x / 2) + (2 * (2 - 1) / 2) % mod * (x / 2) % mod) % mod;     }     int d = prm[x];     if (d < 0) return dp[x];     return dp[x] = (dfs(x / d) + (d * (d - 1) / 2) % mod * (x / d) % mod) % mod;   }   long long getpw(long long x, long long y) {     long long res = 1LL;     while (y) {       if (y & 1) res = res * x % mod;       x = x * x % mod;       y /= 2;     }     return res;   }   int main() {     cin >> t >> l >> r;     memset(prm, -1, sizeof(prm));     for (int i = 2; i * i <= r; ++i) {       if (prm[i] < 0) {         for (int j = 2 * i; j <= r; j += i) {           if (prm[j] < 0) prm[j] = i;         }       }     }     pw[0] = 1LL;     for (int i = 1; i <= r; ++i) {       pw[i] = pw[i - 1] * (long long)t % mod;     }     memset(dp, -1, sizeof(dp));     long long res = 0LL;     for (int i = 2; i <= r; ++i) {       if (dp[i] < 0) {         dfs(i);         if (i >= l && i <= r) {           long long tmp = dp[i] * pw[i - l] % mod;           res = (res + tmp) % mod;         }       }     }     cout << res << endl;     return 0;   }   