stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long int LL;

typedef long double LD;



const int MOD = 1e9 + 7;

const int MAXS = 1 << 17;



int main() {

	int N, X, Y, Z;

	cin >> N >> X >> Y >> Z;



	int xyz = (1 << (X + Y + Z - 1)) | (1 << (Y + Z - 1)) | (1 << (Z - 1));

	int mask = (1 << (X + Y + Z)) -1;



	int dp[2][MAXS];

	int idx = 0, _idx;

	dp[idx][0] = 1;

	for (int k = 0; k < N; ++k) {

		_idx = idx;

		idx ^= 1;

		memset(dp[idx], 0, sizeof(dp[idx]));

		for (int i = 0; i <= mask; ++i) {

			if (dp[_idx][i] > 0) {

				for (int j = 1; j <= 10; j++) {

					int _i = ((i << j) | (1 << (j-1))) & mask;

					if ((_i&xyz) != xyz) (dp[idx][_i] += dp[_idx][i]) %= MOD;

				}

			}

		}

	}

	long res = 1;

	for (int i = 0; i < N; ++i) (res *= 10) %= MOD;

	for (int i = 0; i <= mask; ++i) (res -= dp[idx][i]) %= MOD;



	cout << (res + MOD) % MOD << endl;



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.5271672700378518x):
#include <bits/stdc++.h>

using namespace std;

typedef long long int LL;

typedef long double LD;



const int MOD = 1e9 + 7;

const int MAXS = 1 << 16;



int main() {

	int N, X, Y, Z;

	cin >> N >> X >> Y >> Z;



	int xyz = (1 << (X + Y + Z - 1)) | (1 << (Y + Z - 1)) | (1 << (Z - 1));

	int mask = (1 << (X + Y + Z)) - 1;

	int mask2 = mask >> 1;



	int dp[2][MAXS];

	int idx = 0, _idx;

	dp[idx][0] = 1;

	for (int k = 0; k < N; ++k) {

		_idx = idx;

		idx ^= 1;

		memset(dp[idx], 0, sizeof(dp[idx]));

		for (int i = 0; i <= mask2; ++i) {

			if (dp[_idx][i] > 0) {

				for (int j = 1; j <= 10; j++) {

					int _i = ((i << j) | (1 << (j-1))) & mask;

					if ((_i&xyz) != xyz) (dp[idx][_i&mask2] += dp[_idx][i]) %= MOD;

				}

			}

		}

	}

	long res = 1;

	for (int i = 0; i < N; ++i) (res *= 10) %= MOD;

	for (int i = 0; i <= mask2; ++i) (res -= dp[idx][i]) %= MOD;



	cout << (res + MOD) % MOD << endl;



	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=45;

typedef long long LL;

LL dp[maxn][1<<18];

int n,x,y,z;

int main() {

    scanf("%d%d%d%d",&n,&x,&y,&z);

    int tmp=x+y+z-1;

    LL mask=(1<<tmp)-1;

    LL limit=1<<tmp;

    LL no=(1<<(x+y+z-1)) | (1<<(y+z-1)) | (1<<(z-1));

    dp[0][0]=1;

    for (int i=0;i<n;i++) {

        for (int j=0;j<limit;j++) {

            for (int k=1;k<=10;k++) {

                LL t=(j<<k) | (1<<(k-1));

                if ((no&t)==no) continue;

                dp[i+1][t&mask]=(dp[i+1][t&mask]+dp[i][j])%mod;

            }

        }

    }

    LL ans=1;

    for (int i=1;i<=n;i++) ans=ans*10%mod;

    for (int i=0;i<limit;i++) ans-=dp[n][i];

    printf("%lld\n", (ans%mod+mod)%mod);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.7439679419349807x):
#include <cstdio>



const int mod = 1e9 + 7;

const int MAXN = 45, MAXS = ( 1 << 17 ) + 5;



template<typename _T>

void read( _T &x )

{

	x = 0;char s = getchar();int f = 1;

	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}

	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}

	x *= f;

}



template<typename _T>

void write( _T x )

{

	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }

	if( 9 < x ){ write( x / 10 ); }

	putchar( x % 10 + '0' );

}



int f[MAXN][MAXS];

int N, X, Y, Z, st, all;



int bit( const int i ) { return 1 << i - 1; }

bool chk( const int S ) { return ( S & st ) == st; }

void add( int &x, const int v ) { x = ( x + v >= mod ? x + v - mod : x + v ); }

int insert( const int S, const int v ) { return ( S << v | bit( v ) ) & all; }



int main()

{

	read( N ), read( X ), read( Y ), read( Z );

	int up = 1 << X + Y + Z;

	all = ( bit( X + Y + Z ) << 1 ) - 1;

	st = bit( Z ) | bit( Y + Z ) | bit( X + Y + Z );

	

	f[0][0] = 1;

	for( int i = 0 ; i < N ; i ++ )

		for( int S = 0 ; S < up ; S ++ )

			if( f[i][S] && ! chk( S ) )

				for( int k = 1, T ; k <= 10 ; k ++ )

					if( ! chk( T = insert( S, k ) ) )

						add( f[i + 1][T], f[i][S] );

	int ans = 1;

	for( int i = 1 ; i <= N ; i ++ )

		ans = 10ll * ans % mod;

	for( int S = 0 ; S < up ; S ++ )

		if( ! chk( S ) )

			add( ans, mod - f[N][S] );

	write( ans ), putchar( '\n' );

	return 0;

}
// Slower C++ solution:
#include <iostream> 

#include <cstdio> 

#include <cstdlib> 

#include <cstring> 

#include <cmath> 

#include <algorithm> 

using namespace std; 

const int Mod = 1e9 + 7; 

int N, M, X, Y, Z, f[41][1 << 18]; 

int OK, ALL; 

void pls(int &x, int y) { x += y; if (x >= Mod) x -= Mod; } 

int main () { 

	cin >> N >> X >> Y >> Z; 

	M = X + Y + Z; 

	OK = (1 << (X + Y + Z - 1)) | (1 << (Y + Z - 1)) | (1 << (Z - 1)); 

	ALL = (1 << M) - 1; 

	f[0][0] = 1; 

	for (int i = 1; i <= N; i++) { 

		for (int s = 0; s < 1 << M; s++) { 

			for (int j = 1; j < 11; j++) { 

				int t = ((s << j) | (1 << (j - 1))) & ALL; 

				if ((t & OK) == OK) continue; 

				pls(f[i][t], f[i - 1][s]); 

			} 

		} 

	} 

	int ans = 1; 

	for (int i = 1; i <= N; i++) ans = 10ll * ans % Mod; 

	for (int i = 0; i < 1 << M; i++) ans = (ans - f[N][i] + Mod) % Mod; 

	printf("%d\n", ans); 

    return 0; 

} 

// Faster C++ solution for the same problem (measured speedup: 3.9952949419685746x):
#include <cstdio>



const int mod = 1e9 + 7;

const int MAXN = 45, MAXS = ( 1 << 17 ) + 5;



template<typename _T>

void read( _T &x )

{

	x = 0;char s = getchar();int f = 1;

	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}

	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}

	x *= f;

}



template<typename _T>

void write( _T x )

{

	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }

	if( 9 < x ){ write( x / 10 ); }

	putchar( x % 10 + '0' );

}



int f[MAXN][MAXS];

int N, X, Y, Z, st, all;



int bit( const int i ) { return 1 << i - 1; }

bool chk( const int S ) { return ( S & st ) == st; }

void add( int &x, const int v ) { x = ( x + v >= mod ? x + v - mod : x + v ); }

int insert( const int S, const int v ) { return ( S << v | bit( v ) ) & all; }



int main()

{

	read( N ), read( X ), read( Y ), read( Z );

	int up = 1 << X + Y + Z;

	all = ( bit( X + Y + Z ) << 1 ) - 1;

	st = bit( Z ) | bit( Y + Z ) | bit( X + Y + Z );

	

	f[0][0] = 1;

	for( int i = 0 ; i < N ; i ++ )

		for( int S = 0 ; S < up ; S ++ )

			if( f[i][S] && ! chk( S ) )

				for( int k = 1, T ; k <= 10 ; k ++ )

					if( ! chk( T = insert( S, k ) ) )

						add( f[i + 1][T], f[i][S] );

	int ans = 1;

	for( int i = 1 ; i <= N ; i ++ )

		ans = 10ll * ans % mod;

	for( int S = 0 ; S < up ; S ++ )

		if( ! chk( S ) )

			add( ans, mod - f[N][S] );

	write( ans ), putchar( '\n' );

	return 0;

}
// Slower C++ solution:
#include <algorithm>

#include <climits>

#include <cmath>

#include <cstdio>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <stack>



#define MP std::make_pair

#define rep(i, l, r) for (int i = (l); i <= (r); ++ i)

#define per(i, r, l) for (int i = (r); i >= (l); -- i)

#define PE(x, a) for (int x = head[a]; x;x = edge[x].next)

#define pb push_back

#define CL(a, b) memset(a, b, sizeof a)

#define PII std::pair<int, int>

#define fi first

#define se second

#define all(x) (x).begin(), (x).end()



typedef long long ll;



const ll HA = 1e9 + 7;



ll f[45][(1 << 17) + 7];

int n, x, y, z;



int main() {

	scanf("%d %d %d %d", &n, &x, &y, &z);

	int st = (1 << (z - 1)) | (1 << (z + y - 1)) | (1 << (z + y + x - 1));

	int lim = (1 << (x + y + z)) - 1;

	f[0][0] = 1;

	rep(i, 1, n) {

		rep(s, 0, lim) {

			if ((s & st) != st && f[i - 1][s])

			rep(c, 1, 10) {

				f[i][lim & ((s << c) | (1 << c - 1))] = (f[i][lim & ((s << c) | (1 << c - 1))] + f[i - 1][s]) % HA;

			}

		}

	}

	ll ans  = 0;

	rep(i, 0, lim) if ((i & st) != st) ans = (ans + f[n][i]) % HA;

	ll tmp = 1;

	rep(i, 1, n) tmp = tmp * 10 % HA;

	ans = (tmp - ans + HA) % HA;

	printf("%lld\n", ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 2.585942838271631x):
#include <cstdio>



const int mod = 1e9 + 7;

const int MAXN = 45, MAXS = ( 1 << 17 ) + 5;



template<typename _T>

void read( _T &x )

{

	x = 0;char s = getchar();int f = 1;

	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}

	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}

	x *= f;

}



template<typename _T>

void write( _T x )

{

	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }

	if( 9 < x ){ write( x / 10 ); }

	putchar( x % 10 + '0' );

}



int f[MAXN][MAXS];

int N, X, Y, Z, st, all;



int bit( const int i ) { return 1 << i - 1; }

bool chk( const int S ) { return ( S & st ) == st; }

void add( int &x, const int v ) { x = ( x + v >= mod ? x + v - mod : x + v ); }

int insert( const int S, const int v ) { return ( S << v | bit( v ) ) & all; }



int main()

{

	read( N ), read( X ), read( Y ), read( Z );

	int up = 1 << X + Y + Z;

	all = ( bit( X + Y + Z ) << 1 ) - 1;

	st = bit( Z ) | bit( Y + Z ) | bit( X + Y + Z );

	

	f[0][0] = 1;

	for( int i = 0 ; i < N ; i ++ )

		for( int S = 0 ; S < up ; S ++ )

			if( f[i][S] && ! chk( S ) )

				for( int k = 1, T ; k <= 10 ; k ++ )

					if( ! chk( T = insert( S, k ) ) )

						add( f[i + 1][T], f[i][S] );

	int ans = 1;

	for( int i = 1 ; i <= N ; i ++ )

		ans = 10ll * ans % mod;

	for( int S = 0 ; S < up ; S ++ )

		if( ! chk( S ) )

			add( ans, mod - f[N][S] );

	write( ans ), putchar( '\n' );

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define mo 1000000007

int i,j,k,m,n,x,y,z,S,Ans,ans,dp[41][1<<17];

inline ll Pow(ll x,ll d) {

    ll ans = 1, y = x;

    for (; d; y = y * y % mo, d >>= 1)d & 1 ? ans = ans * y % mo : 0;

    return ans;

}

int main() {

    cin >> n >> x >> y >> z;

    S = (1 << x + y + z) - 1;

    ans = (1 << x - 1) | (1 << x + y - 1) | (1 << x + y + z - 1);

    dp[0][0] = 1;

    for (i = 1; i <= n; ++i)

        for (j = 0; j <= S; ++j)

            if (dp[i - 1][j])

                for (k = 1; k <= 10; ++k) {

                    int o = ((j << k) | (1 << k - 1)) & S;

                    if ((o & ans) == ans)(Ans += 1ll * dp[i - 1][j] * Pow(10, n - i) % mo) %= mo;

                    else (dp[i][o] += (dp[i - 1][j]) % mo) %= mo;

                }

    printf("%d\n", Ans);

}

// Faster C++ solution for the same problem (measured speedup: 2.216286962005532x):
#include <cstdio>



const int mod = 1e9 + 7;

const int MAXN = 45, MAXS = ( 1 << 17 ) + 5;



template<typename _T>

void read( _T &x )

{

	x = 0;char s = getchar();int f = 1;

	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}

	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}

	x *= f;

}



template<typename _T>

void write( _T x )

{

	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }

	if( 9 < x ){ write( x / 10 ); }

	putchar( x % 10 + '0' );

}



int f[MAXN][MAXS];

int N, X, Y, Z, st, all;



int bit( const int i ) { return 1 << i - 1; }

bool chk( const int S ) { return ( S & st ) == st; }

void add( int &x, const int v ) { x = ( x + v >= mod ? x + v - mod : x + v ); }

int insert( const int S, const int v ) { return ( S << v | bit( v ) ) & all; }



int main()

{

	read( N ), read( X ), read( Y ), read( Z );

	int up = 1 << X + Y + Z;

	all = ( bit( X + Y + Z ) << 1 ) - 1;

	st = bit( Z ) | bit( Y + Z ) | bit( X + Y + Z );

	

	f[0][0] = 1;

	for( int i = 0 ; i < N ; i ++ )

		for( int S = 0 ; S < up ; S ++ )

			if( f[i][S] && ! chk( S ) )

				for( int k = 1, T ; k <= 10 ; k ++ )

					if( ! chk( T = insert( S, k ) ) )

						add( f[i + 1][T], f[i][S] );

	int ans = 1;

	for( int i = 1 ; i <= N ; i ++ )

		ans = 10ll * ans % mod;

	for( int S = 0 ; S < up ; S ++ )

		if( ! chk( S ) )

			add( ans, mod - f[N][S] );

	write( ans ), putchar( '\n' );

	return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int mod=1e9+7;

const int maxn=45;

typedef long long LL;

LL dp[maxn][1<<18];

int n,x,y,z;

int main() {

    scanf("%d%d%d%d",&n,&x,&y,&z);

    int tmp=x+y+z-1;

    LL mask=(1<<tmp)-1;

    LL limit=1<<tmp;

    LL no=(1<<(x+y+z-1)) | (1<<(y+z-1)) | (1<<(z-1));

    dp[0][0]=1;

    for (int i=0;i<n;i++) {

        for (int j=0;j<limit;j++) {

            for (int k=1;k<=10;k++) {

                LL t=(j<<k) | (1<<(k-1));

                if ((no&t)==no) continue;

                dp[i+1][t&mask]=(dp[i+1][t&mask]+dp[i][j])%mod;

            }

        }

    }

    LL ans=1;

    for (int i=1;i<=n;i++) ans=ans*10%mod;

    for (int i=0;i<limit;i++) ans-=dp[n][i];

    printf("%lld\n", (ans%mod+mod)%mod);

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.918494104505566x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long LL;

const int mod = 1e9 + 7;



int n , x , y , z;

int dp[50][1 << 18];



int main() {

	scanf("%d %d %d %d" , &n , &x , &y , &z);

	int st = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));

	dp[0][0] = 1;

	int ans = 1;

	for (int i = 1; i <= n; ++i) {

		ans = (LL)ans * 10 % mod;

		for (int j = 0; j < (1 << (x + y + z)); ++j) {

			if(dp[i - 1][j] && (j & st) != st) {

				for (int k = 1; k <= 10; ++k) {

					int now = (j << k) | (1 << (k - 1));

					now &= (1 << (x + y + z)) - 1;

					dp[i][now] = (dp[i][now] + dp[i - 1][j]) % mod;

				}

			} 

		}

	}

	for (int i = 0; i < (1 << (x + y + z)); ++ i) {

		if((i & st) != st) ans = ((ans - dp[n][i]) % mod + mod) % mod;

	}

	printf("%d" , ans);

	return 0;

}
// Slower C++ solution:
#include <iostream> 

#include <cstdio> 

#include <cstdlib> 

#include <cstring> 

#include <cmath> 

#include <algorithm> 

using namespace std; 

const int Mod = 1e9 + 7; 

int N, M, X, Y, Z, f[41][1 << 18]; 

int OK, ALL; 

void pls(int &x, int y) { x += y; if (x >= Mod) x -= Mod; } 

int main () { 

	cin >> N >> X >> Y >> Z; 

	M = X + Y + Z; 

	OK = (1 << (X + Y + Z - 1)) | (1 << (Y + Z - 1)) | (1 << (Z - 1)); 

	ALL = (1 << M) - 1; 

	f[0][0] = 1; 

	for (int i = 1; i <= N; i++) { 

		for (int s = 0; s < 1 << M; s++) { 

			for (int j = 1; j < 11; j++) { 

				int t = ((s << j) | (1 << (j - 1))) & ALL; 

				if ((t & OK) == OK) continue; 

				pls(f[i][t], f[i - 1][s]); 

			} 

		} 

	} 

	int ans = 1; 

	for (int i = 1; i <= N; i++) ans = 10ll * ans % Mod; 

	for (int i = 0; i < 1 << M; i++) ans = (ans - f[N][i] + Mod) % Mod; 

	printf("%d\n", ans); 

    return 0; 

} 

// Faster C++ solution for the same problem (measured speedup: 2.7807329311989655x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long LL;

const int mod = 1e9 + 7;



int n , x , y , z;

int dp[50][1 << 18];



int main() {

	scanf("%d %d %d %d" , &n , &x , &y , &z);

	int st = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));

	dp[0][0] = 1;

	int ans = 1;

	for (int i = 1; i <= n; ++i) {

		ans = (LL)ans * 10 % mod;

		for (int j = 0; j < (1 << (x + y + z)); ++j) {

			if(dp[i - 1][j] && (j & st) != st) {

				for (int k = 1; k <= 10; ++k) {

					int now = (j << k) | (1 << (k - 1));

					now &= (1 << (x + y + z)) - 1;

					dp[i][now] = (dp[i][now] + dp[i - 1][j]) % mod;

				}

			} 

		}

	}

	for (int i = 0; i < (1 << (x + y + z)); ++ i) {

		if((i & st) != st) ans = ((ans - dp[n][i]) % mod + mod) % mod;

	}

	printf("%d" , ans);

	return 0;

}
// Slower C++ solution:
#include <algorithm>

#include <climits>

#include <cmath>

#include <cstdio>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <set>

#include <stack>



#define MP std::make_pair

#define rep(i, l, r) for (int i = (l); i <= (r); ++ i)

#define per(i, r, l) for (int i = (r); i >= (l); -- i)

#define PE(x, a) for (int x = head[a]; x;x = edge[x].next)

#define pb push_back

#define CL(a, b) memset(a, b, sizeof a)

#define PII std::pair<int, int>

#define fi first

#define se second

#define all(x) (x).begin(), (x).end()



typedef long long ll;



const ll HA = 1e9 + 7;



ll f[45][(1 << 17) + 7];

int n, x, y, z;



int main() {

	scanf("%d %d %d %d", &n, &x, &y, &z);

	int st = (1 << (z - 1)) | (1 << (z + y - 1)) | (1 << (z + y + x - 1));

	int lim = (1 << (x + y + z)) - 1;

	f[0][0] = 1;

	rep(i, 1, n) {

		rep(s, 0, lim) {

			if ((s & st) != st && f[i - 1][s])

			rep(c, 1, 10) {

				f[i][lim & ((s << c) | (1 << c - 1))] = (f[i][lim & ((s << c) | (1 << c - 1))] + f[i - 1][s]) % HA;

			}

		}

	}

	ll ans  = 0;

	rep(i, 0, lim) if ((i & st) != st) ans = (ans + f[n][i]) % HA;

	ll tmp = 1;

	rep(i, 1, n) tmp = tmp * 10 % HA;

	ans = (tmp - ans + HA) % HA;

	printf("%lld\n", ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8713783795142909x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long LL;

const int mod = 1e9 + 7;



int n , x , y , z;

int dp[50][1 << 18];



int main() {

	scanf("%d %d %d %d" , &n , &x , &y , &z);

	int st = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));

	dp[0][0] = 1;

	int ans = 1;

	for (int i = 1; i <= n; ++i) {

		ans = (LL)ans * 10 % mod;

		for (int j = 0; j < (1 << (x + y + z)); ++j) {

			if(dp[i - 1][j] && (j & st) != st) {

				for (int k = 1; k <= 10; ++k) {

					int now = (j << k) | (1 << (k - 1));

					now &= (1 << (x + y + z)) - 1;

					dp[i][now] = (dp[i][now] + dp[i - 1][j]) % mod;

				}

			} 

		}

	}

	for (int i = 0; i < (1 << (x + y + z)); ++ i) {

		if((i & st) != st) ans = ((ans - dp[n][i]) % mod + mod) % mod;

	}

	printf("%d" , ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define mo 1000000007

int i,j,k,m,n,x,y,z,S,Ans,ans,dp[41][1<<17];

inline ll Pow(ll x,ll d) {

    ll ans = 1, y = x;

    for (; d; y = y * y % mo, d >>= 1)d & 1 ? ans = ans * y % mo : 0;

    return ans;

}

int main() {

    cin >> n >> x >> y >> z;

    S = (1 << x + y + z) - 1;

    ans = (1 << x - 1) | (1 << x + y - 1) | (1 << x + y + z - 1);

    dp[0][0] = 1;

    for (i = 1; i <= n; ++i)

        for (j = 0; j <= S; ++j)

            if (dp[i - 1][j])

                for (k = 1; k <= 10; ++k) {

                    int o = ((j << k) | (1 << k - 1)) & S;

                    if ((o & ans) == ans)(Ans += 1ll * dp[i - 1][j] * Pow(10, n - i) % mo) %= mo;

                    else (dp[i][o] += (dp[i - 1][j]) % mo) %= mo;

                }

    printf("%d\n", Ans);

}

// Faster C++ solution for the same problem (measured speedup: 1.6382765794728087x):
#include <cstdio>

#include <algorithm>

using namespace std;

typedef long long LL;

const int mod = 1e9 + 7;



int n , x , y , z;

int dp[50][1 << 18];



int main() {

	scanf("%d %d %d %d" , &n , &x , &y , &z);

	int st = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));

	dp[0][0] = 1;

	int ans = 1;

	for (int i = 1; i <= n; ++i) {

		ans = (LL)ans * 10 % mod;

		for (int j = 0; j < (1 << (x + y + z)); ++j) {

			if(dp[i - 1][j] && (j & st) != st) {

				for (int k = 1; k <= 10; ++k) {

					int now = (j << k) | (1 << (k - 1));

					now &= (1 << (x + y + z)) - 1;

					dp[i][now] = (dp[i][now] + dp[i - 1][j]) % mod;

				}

			} 

		}

	}

	for (int i = 0; i < (1 << (x + y + z)); ++ i) {

		if((i & st) != st) ans = ((ans - dp[n][i]) % mod + mod) % mod;

	}

	printf("%d" , ans);

	return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main(){

	int n, p;

	cin >> n >> p;

	int64_t dp[n + 1][100 * n + 1]{};

	dp[0][0] = 1;

	for(int i = 0; i < n; i++){

		int a;

		cin >> a;

		for(int j = 0; j < 100 * n + 1; j++){

			dp[i + 1][j] = dp[i][j];

			if(0 <= j - a) dp[i + 1][j] += dp[i][j - a];

		}

	}

	int64_t ans = 0;

	for(int j = p; j < 100 * n + 1; j += 2) ans += dp[n][j];

	cout << ans << endl;

}

// Faster C++ solution for the same problem (measured speedup: 3.062823203152513x):
#include <iostream>

using namespace std;



int64_t pow(int64_t a, int n){

	int64_t r = 1;

	while(n){

		if(n & 1) r *= a;

		a *= a;

		n >>= 1;

	}

	return r;

}



int main(){

	int n, p;

	cin >> n >> p;

	int odd = 0;

	for(int i = 0; i < n; i++){

		int a;

		cin >> a;

		if(a & 1) odd++;

	}

	cout << (odd ? pow(2, n - 1) : p ? 0 : pow(2, n)) << endl;

}
// Slower C++ solution:
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

typedef  long long ll;

typedef  vector<int> vi;

typedef  pair<int,int> pii;

typedef  pair<int,string> pis;

double pi=3.1415926535898;

#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

#define lop(i,n)   for(int i=0;i<int(n);i++)

#define rep(i,a,b) for(int i=a;i<=int(b);++i)

#define rng(i,a,b) for(int i=a;i>=int(b);i--)

#define ms(x,a)    memset(x,a,sizeof(x))

#define all(x)     (x).begin(),(x).end()

#define sz(x)      int(x.size())

#define pb         push_back

#define r0         return 0;

#define CC         continue;

#define bb(x)      cerr<< x <<endl;

#define F          first

#define S          second       //  __builtin_popcount;

//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);

const ll M  = 1e9+7 ;

const int N = 300100;

const int inf = INT_MAX;

const double eps = 1e-7;

//////////////////////    Hi    ^_^  hack me if you can :P



int a[100];

int n, p;

int s;

ll mem[100][5005];

ll dp ( int i, int s)

{

    if ( i == n) return s%2 == p;

    ll &r = mem[i][s];

    if (r!=-1)

    {

        return r;

    }

    return r = dp(i+1,s+a[i])+dp(i+1,s);

}

int main()

{

    speed;

    cin >> n >> p;

    lop(i,n) cin >> a[i];

    ms(mem,-1);

    cout << dp(0,0);



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.7509894553332765x):
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

typedef  long long ll;

typedef  vector<int> vi;

typedef  pair<int,int> pii;

typedef  pair<int,string> pis;

double pi=3.1415926535898;

#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

#define lop(i,n)   for(int i=0;i<int(n);i++)

#define rep(i,a,b) for(int i=a;i<=int(b);++i)

#define rng(i,a,b) for(int i=a;i>=int(b);i--)

#define ms(x,a)    memset(x,a,sizeof(x))

#define all(x)     (x).begin(),(x).end()

#define sz(x)      int(x.size())

#define pb         push_back

#define r0         return 0;

#define CC         continue;

#define bb(x)      cerr<< x <<endl;

#define F          first

#define S          second       //  __builtin_popcount;

//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);

const ll M  = 1e9+7 ;

const int N = 300100;

const int inf = INT_MAX;

const double eps = 1e-7;

//////////////////////    Hi    ^_^  hack me if you can :P

 

int a[100];

int n, p;

int s;

ll mem[55][2];

ll dp ( int i, int s)

{

    if ( i == n) return s%2 == p;

    ll &r = mem[i][s%2];

    if (r!=-1)

    {

        return r;

    }

    return r = dp(i+1,(s+a[i])%2 )+dp(i+1,s%2);

}

int main()

{

    speed;

    cin >> n >> p;

    lop(i,n) cin >> a[i];

    ms(mem,-1);

    cout << dp(0,0);

 

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;

long long n, p, a, s, ans, d[55][5005]={1};

int main() {

	int i, j;

	cin>>n>>p;

	for(i=1; i<=n; i++) {

		cin>>a;

		for(j=s; j>=0; j--)

			if(d[i-1][j]) {

				d[i][j] += d[i-1][j];

				d[i][j+a] += d[i-1][j];

			}

		s += a;

	}

	for(j=p; j<=s; j+=2) ans += d[n][j];

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4644106876332332x):
#include <iostream>

using namespace std;

long long n, p, a, s=1, c[2];

int main() {

	cin>>n>>p;

	while(n--) cin>>a, c[a%2]=1, s<<=1;

	cout<<(c[1] ? s/2 : p?0:s);

	return 0;

}