#include #define mod 1000000007 using namespace std; using Graph=vector>; long long remtop(long long v){ if(v<10){return 0;} string mem=to_string(v); mem.erase(0,1); return stoll(mem); } int main(){ set st; map mp; long long n,a,b; cin >> n >> a >> b; long long f[128]; f[0]=1;f[1]=1; for(int i=0;;i++){ if(i>=2){f[i]=f[i-1]+f[i-2];} if(f[i]>b){break;} if(f[i]0){ st.insert(v); v/=10; } } st.insert(0); int c=0; long long val[524288]; for(auto x: st){ if(mp[x]==-1){continue;} //printf("[[[%lld]]]\n",x); mp[x]=c; val[c]=x; c++; } //printf("%d\n",mp[55]); Graph g(c); for(int i=0;i0){ if(mp[nv]==-1){k=-1;break;} if(mp[nv]!=0 && k==0){k=mp[nv];} nv=remtop(nv); } //printf("%d(%d + %d) -> %d\n",i,cv,j,k); if(k==-1){continue;} g[i].push_back(k); } } long long dp[5005][5005]={0},res=0; for(int i=0;i