#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; class mint{ static const int MOD=1e9+7; int x; public: mint():x(0){} mint(long long y){ x=y%MOD; if(x<0) x+=MOD; } mint& operator+=(const mint& m){ x+=m.x; if(x>=MOD) x-=MOD; return *this; } mint& operator-=(const mint& m){ x-=m.x; if(x< 0) x+=MOD; return *this; } mint& operator*=(const mint& m){ x=1LL*x*m.x%MOD; return *this; } mint& operator/=(const mint& m){ return *this*=inverse(m); } mint operator+(const mint& m)const{ return mint(*this)+=m; } mint operator-(const mint& m)const{ return mint(*this)-=m; } mint operator*(const mint& m)const{ return mint(*this)*=m; } mint operator/(const mint& m)const{ return mint(*this)/=m; } mint operator-()const{ return -x; } friend mint inverse(const mint& m){ int a=m.x,b=MOD,u=1,v=0; while(b>0){ int t=a/b; a-=t*b; swap(a,b); u-=t*v; swap(u,v); } return u; } friend istream& operator>>(istream& is,mint& m){ long long t; is>>t; m=t; return is; } friend ostream& operator<<(ostream& os,const mint& m){ return os< F; map>,mint> memo[5000]; mint dfs(int i,vector> match){ if(i==n){ return 1; } if(memo[i].count(match)>0) return memo[i][match]; mint& res=memo[i][match]; for(char d='0';d<='9';d++){ vector> match2; bool ng=false; for(auto [id,len]:match){ if(F[id][len]==d){ if(F[id].length()==len+1){ ng=true; break; } match2.emplace_back(id,len+1); } } if(ng) continue; rep(id,F.size()){ if(F[id][0]==d){ if(F[id].length()==1){ ng=true; break; } match2.emplace_back(id,1); } } if(ng) continue; sort(match2.begin(),match2.end()); res+=dfs(i+1,match2); } return res; } int main(){ lint l,r; scanf("%d%lld%lld",&n,&l,&r); lint fib[90]={1,1}; for(int i=2;i<90;i++){ fib[i]=fib[i-1]+fib[i-2]; } for(int i=1;i<90;i++){ if(l<=fib[i] && fib[i]<=r){ F.emplace_back(to_string(fib[i])); } } cout<