#include #pragma GCC optimize("Ofast") #define _GLIBCXX_DEBUG using namespace std; using std::cout; using std::cin; using std::endl; using ll=long long; using ld=long double; ll ILL=1167167167167167167; const int INF=2100000000; const ll mod=1e9+7; #define rep(i,a) for (ll i=0;i using _pq = priority_queue, greater>; template ll LB(vector &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();} template ll UB(vector &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();} template bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;} template bool chmax(T &a,const T &b){if(a void So(vector &v) {sort(v.begin(),v.end());} template void Sore(vector &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});} void yneos(bool a){if(a) cout<<"Yes\n"; else cout<<"No\n";} string tran(ll a){ string S; while(a){ S+=(char)('0'+a%10); a/=10; } reverse(S.begin(),S.end()); return S; } void solve(); // oddloop int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t=1; //cin>>t; rep(i,t) solve(); } void solve(){ ll N,L,R; cin>>N>>L>>R; ll a=1,b=2,c; vector pref={""}; vector p; while(a<=R){ string S=tran(a); c=a; swap(a,b); b+=a; if(c ng(len); vector> next(len,vector(10)); rep(i,len){ int x=pref[i].size(); rep(j,x){ if(p[LB(p,pref[i].substr(j,x-j))]==pref[i].substr(j,x-j)){ ng[i]=1; break; } } rep(k,10){ string S=pref[i]; S+=(char)('0'+k); next[i][k]=0; rep(j,x+1){ int b=LB(pref,S.substr(j,x+1-j)); if(pref[b]==S.substr(j,x+1-j)){ next[i][k]=b; break; } } } } vector dp(len); dp[0]=1; rep(i,N){ vector n_dp(len); rep(j,len){ dp[j]%=mod; if(dp[j]==0) continue; rep(k,10){ if(ng[next[j][k]]) continue; n_dp[next[j][k]]+=dp[j]; } } swap(n_dp,dp); } ll ans=mod-1; rep(i,len) ans=(ans+dp[i])%mod; cout<