Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,x,y,z;
vector<string> vx,vy,vz;
void dfs(int v,string now,vector<string> &a){
	if (!v) return a.push_back(now);
	now+='.';
	for (int i=1;i<=v;i++) now[now.size()-1]=i-1,dfs(v-i,now,a);
}
typedef long long ll;
const int N=1e5+10,p=1e9+7;
int inc(int x,int y){x+=y;return x>=p?x-p:x;}
int mul(int x,int y){return (ll)x*y%p;}
int go[N][10],fail[N],top=1;
bool end[N];
void trie(string s){
	int p=1;
	for (int i=0;i<s.size();i++){
		int w=s[i];
		if (!go[p][w]) go[p][w]=++top;
		p=go[p][w];
	}
	end[p]=1;
}
queue<int> Q;
void getfail(){
	for (int i=0;i<10;i++)
		if (go[1][i]) fail[go[1][i]]=1,Q.push(go[1][i]);
			else go[1][i]=1;
	while (!Q.empty()){
		int v=Q.front();Q.pop();
		for (int i=0;i<10;i++)
		if (go[v][i]){
			fail[go[v][i]]=go[fail[v]][i];
			Q.push(go[v][i]);
		}
		else go[v][i]=go[fail[v]][i];
	}
}
int dp[50][N],mi[50];
int main()
{
	cin>>n>>x>>y>>z;
	dfs(x,string(),vx);
	dfs(y,string(),vy);
	dfs(z,string(),vz);
	for (int i=0;i<vx.size();i++)
	for (int j=0;j<vy.size();j++)
	for (int k=0;k<vz.size();k++)
		trie(vx[i]+vy[j]+vz[k]);
	getfail();
	mi[0]=1;
	for (int i=1;i<=n;i++) mi[i]=mul(mi[i-1],10);
	int ans=0;
	dp[0][1]=1;
	for (int i=0;i<n;i++)
	for (int v=1;v<=top;v++)
	for (int w=0;w<10;w++){
		int p=go[v][w];
		if (end[p]) ans=inc(ans,mul(dp[i][v],mi[n-i-1]));
		else dp[i+1][p]=inc(dp[i+1][p],dp[i][v]);
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'void trie(std::string)':
a.cc:23:9: error: reference to 'end' is ambiguous
   23 |         end[p]=1;
      |         ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1249:5: note:                 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1249 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:106:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
                 from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/initializer_list:99:5: note:                 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
a.cc:15:6: note:                 'bool end [100010]'
   15 | bool end[N];
      |      ^~~
a.cc: In function 'int main()':
a.cc:60:21: error: reference to 'end' is ambiguous
   60 |                 if (end[p]) ans=inc(ans,mul(dp[i][v],mi[n-i-1]));
      |                     ^~~
/usr/include/c++/14/valarray:1265:5: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/valarray:1249:5: note:                 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
 1249 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  106 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   85 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note:                 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   74 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/14/initializer_list:99:5: note:                 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
   99 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
a.cc:15:6: note:                 'bool end [100010]'
   15 | bool end[N];
      |      ^~~