#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll K,L,R; ll F[100],S[100],P[100]; ll mo=1000000007; string ST[100]; ll modpow(ll a, ll n = mo-2) { ll r=1; while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1; return r; } pair getval(int K,ll V) { if(V<=0) return {0,0}; if(V==F[K]) return {S[K],P[K]}; if(V<=F[K-1]) { return getval(K-1,V); } else { pair r = {S[K-1],P[K-1]}; V -= F[K-1]; ll i; FOR(i,min(V,(ll)ST[K].size())) { char c=ST[K][i]; if(c==0) (r.second*=10)%=mo; else { r.first += c; (r.second *= c)%=mo; } } if(V>ST[K].size()) { auto b=getval(K-1,V-ST[K].size()); r.first += b.first; (r.second *= b.second)%=mo; } return r; } } void solve() { int i,j,k,l,r,x,y; string s; F[1]=S[1]=P[1]=1; ST[1]="1"; ST[1][0]-='0'; for(i=2;i<=60;i++) { F[i]=2*F[i-1]; S[i]=2*S[i-1]; P[i]=P[i-1]*P[i-1]%mo; char buf[20]; sprintf(buf,"%d",i*i); ST[i]=buf; FORR(c,ST[i]) { c-='0'; F[i]++; S[i]+=c; if(c==0) P[i]=P[i]*10%mo; else P[i]=P[i]*c%mo; } } cin>>K>>L>>R; if(K>60) K=60; if(R>F[K]) return _P("-1\n"); auto RR = getval(K,R); if(L>1) { auto LL = getval(K,L-1); cout<