stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include<sstream>

#include<iostream>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<climits>

#include<cmath>

#include<string>

#include<vector>

#include<set>

#include<map>

#include<queue>

#include<numeric>

#include<functional>

#include<algorithm>

#include<bitset>

#include<tuple>

#include<unordered_set>

#include<random>

using namespace std;

#define INF (1<<29)

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

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

#define uniq(v) v.erase(unique(all(v)),v.end())





#define MOD 1000000007









int dp[2][1 << 16];





int main() {

	ios::sync_with_stdio(0);

	cin.tie(0);

	int n, x, y, z;

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



	long long ans = 1;

	rep(i, n)(ans *= 10) %= MOD;



	int(*cur)=dp[0], (*nxt)=dp[1];

	cur[0] = 1;

	rep(i,n) {

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

		rep(j,1<<x+y+z-1) if(cur[j]){

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

				int b = j << a;

				b |= 1 << a - 1;

				if ((b & 1 << x - 1) == 0 || (b & 1 << x + y - 1) == 0 || (b & 1 << x + y + z - 1) == 0) {

					(nxt[b&((1 << x + y + z - 1) - 1)] += cur[j]) %= MOD;

				}

			}

		}

		swap(cur, nxt);

	}

	rep(i,1<<x+y+z-1) {

		ans -= cur[i];

	}

	ans %= MOD;

	ans += MOD;

	ans %= MOD;

	cout << ans << endl;



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.7537247027677219x):
#define _CRT_SECURE_NO_WARNINGS

#include<sstream>

#include<iostream>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<climits>

#include<cmath>

#include<string>

#include<vector>

#include<set>

#include<map>

#include<queue>

#include<numeric>

#include<functional>

#include<algorithm>

#include<bitset>

#include<tuple>

#include<unordered_set>

#include<random>

using namespace std;

#define INF (1<<29)

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

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

#define uniq(v) v.erase(unique(all(v)),v.end())





#define MOD 1000000007







long long dp[41][1 << 16];



int trash[1 << 16];







int main() {

	ios::sync_with_stdio(0);

	cin.tie(0);

	int n, x, y, z;

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

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



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

		int a = i;

		int n = x + y + z - 1;

		while ((a & 1 << x + y + z - 1) == 0) {

			a = a << 1 | 1;

			n--;

		}

		if ((a&haiku) != haiku) trash[i] = trash[i&~(1 << n)];

		else trash[i] = i;

	}



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

	dp[0][0] = 1;

	rep(i, n) {

		rep(j, 1 << x + y + z - 1) if (dp[i][j]) {

			dp[i][j] %= MOD;

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

				int b = j << a | 1 << a - 1;

				if ((b&haiku) != haiku) {

					dp[i + 1][trash[b&mask]] += dp[i][j];

				}

			}

		}

	}



	long long ans = 1;

	rep(i, n)(ans *= 10) %= MOD;

	rep(i, 1 << x + y + z - 1) {

		(ans -= dp[n][i]) %= MOD;

	}

	ans += MOD;

	ans %= MOD;

	cout << ans << endl;



	return 0;

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

#define int long long

#define rg register

#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

using namespace std;

const int mod=1e9+7;

int read(){

    int x=0,f=1;char c=getchar();

    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();

    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();

    return f*x;

}

int f[41][262143+10];

int ksm(int a,int b){

	int ans=1;

	while(b){

		if(b&1) ans=ans*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return ans;

}

main(){

    //file("");

	int n=read(),x=read(),y=read(),z=read(),len=(1<<(x+y+z))-1,res=1<<(x+y+z-1)|(1<<(y+z-1))|(1<<(z-1)),ans=0;

	f[0][0]=1;

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

		for(int j=0;j<=len;j++)

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

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

				z&=len;

				if((z&res)==res) continue;

				f[i][z]=(f[i-1][j]+f[i][z])%mod;

		}

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

		ans=(ans+f[n][i])%mod;

	cout<<(ksm(10,n)-ans+mod)%mod;

    return 0;

}

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

#include <cstdio>

#include <cstring>

#include <algorithm>

using std::min; using std::max;

using std::swap; using std::sort;

typedef long long ll;



template<typename T>

void read(T &x) {

	int flag = 1; x = 0; char ch = getchar();

	while(ch < '0' || ch > '9') { if(ch == '-') flag = -flag; ch = getchar(); }

	while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();

	x *= flag;

}



const int _ = 42, __ = 1.5e5 + 10, P = 1e9 + 7;

int n, x, y, z, f[_][__], lim, Q;



int main () {

	read(n), read(x), read(y), read(z);

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

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

	f[0][0] = 1; int ret = 1;

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

		ret = 1ll * ret * 10 % P;

		for(int s = 0; s <= lim; ++s)

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

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

				if(!f[i][s] || (t & Q) == Q) continue;

				(f[i + 1][t] += f[i][s]) %= P;

			}

	}

	for(int s = 0; s <= lim; ++s) (ret += P - f[n][s]) %= P;

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

	return 0;

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

#define int long long

#define rg register

#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

using namespace std;

const int mod=1e9+7;

int read(){

    int x=0,f=1;char c=getchar();

    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();

    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();

    return f*x;

}

int f[41][262143+10];

int ksm(int a,int b){

	int ans=1;

	while(b){

		if(b&1) ans=ans*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return ans;

}

main(){

    //file("");

	int n=read(),x=read(),y=read(),z=read(),len=(1<<(x+y+z))-1,res=1<<(x+y+z-1)|(1<<(y+z-1))|(1<<(z-1)),ans=0;

	f[0][0]=1;

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

		for(int j=0;j<=len;j++)

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

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

				z&=len;

				if((z&res)==res) continue;

				f[i][z]=(f[i-1][j]+f[i][z])%mod;

		}

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

		ans=(ans+f[n][i])%mod;

	cout<<(ksm(10,n)-ans+mod)%mod;

    return 0;

}

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



const int N(45), Mod(1e9 + 7);

int n, X, Y, Z, ans = 1, f[N][1 << 17];



int main()

{

	scanf("%d%d%d%d", &n, &X, &Y, &Z); int S = (1 << (X + Y + Z)) - 1;

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

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

	for (int i = (f[0][0] = 1, 0); i < n; i++)

		for (int T = 0; T <= S; T++) if (f[i][T])

			for (int j = 1, s; j <= 10; j++)

				if (((s = ((T << j) | (1 << (j - 1))) & S) & H) != H)

					f[i + 1][s] = (f[i + 1][s] + f[i][T]) % Mod;

	for (int i = 0; i <= S; i++) ans = (ans - f[n][i] + Mod) % Mod;

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

	return 0;

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

#include <cstdio>

#include <cstring>

#define int long long

#define fre(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)

using namespace std;



inline int read(){

	int sum=0,f=1;char ch=getchar();

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

	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}

	return f*sum;

}



const int N=43;

const int M=1<<17;

const int Mod=1000000007;

int n,X,Y,Z,ans=1,lim,st;

int f[N][M];



signed main(){

	n=read();

	X=read();Y=read();Z=read();

	st|=1<<(Z-1);

	st|=1<<(Y+Z-1);

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

	lim=(1<<(X+Y+Z))-1;

	f[0][0]=1;

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

		ans=ans*10%Mod;

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

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

				int ret=((j<<k)|(1<<(k-1)))&lim;

				if((ret&st)!=st) f[i][ret]=(f[i][ret]+f[i-1][j])%Mod;

			}

		}	   

	}

	for(int j=0;j<lim;j++) ans=(ans-f[n][j])%Mod;

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

	return 0;

}


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



const int N(45), Mod(1e9 + 7);

int n, X, Y, Z, ans = 1, f[N][1 << 17];



int main()

{

	scanf("%d%d%d%d", &n, &X, &Y, &Z); int S = (1 << (X + Y + Z)) - 1;

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

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

	for (int i = (f[0][0] = 1, 0); i < n; i++)

		for (int T = 0; T <= S; T++) if (f[i][T])

			for (int j = 1, s; j <= 10; j++)

				if (((s = ((T << j) | (1 << (j - 1))) & S) & H) != H)

					f[i + 1][s] = (f[i + 1][s] + f[i][T]) % Mod;

	for (int i = 0; i <= S; i++) ans = (ans - f[n][i] + Mod) % Mod;

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

	return 0;

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

#define int long long

#define rg register

#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

using namespace std;

const int mod=1e9+7;

int read(){

    int x=0,f=1;char c=getchar();

    while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();

    while(c>='0'&&c<='9') x=x*10+c-48,c=getchar();

    return f*x;

}

int f[41][262143+10];

int ksm(int a,int b){

	int ans=1;

	while(b){

		if(b&1) ans=ans*a%mod;

		a=a*a%mod;

		b>>=1;

	}

	return ans;

}

main(){

    //file("");

	int n=read(),x=read(),y=read(),z=read(),len=(1<<(x+y+z))-1,res=1<<(x+y+z-1)|(1<<(y+z-1))|(1<<(z-1)),ans=0;

	f[0][0]=1;

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

		for(int j=0;j<=len;j++)

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

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

				z&=len;

				if((z&res)==res) continue;

				f[i][z]=(f[i-1][j]+f[i][z])%mod;

		}

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

		ans=(ans+f[n][i])%mod;

	cout<<(ksm(10,n)-ans+mod)%mod;

    return 0;

}

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

#include<cstring>

#include<cstdio>

#define ll long long

#define qwq

const int mod=1e9+7;

int dp[50][(1<<17)+7];

int n,x,y,z;

ll all_ans=1;

int main(){

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

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

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

	dp[0][0]=1;

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

		all_ans*=10;

		all_ans%=mod;

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

			if((s&gdans)==gdans)continue;

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

				int k=((s<<c)|(1<<(c-1)))&limit;

				if((k&gdans)==gdans)continue;

				dp[i][k]+=dp[i-1][s];

				dp[i][k]%=mod;

			}

		}

	}

	ll ans=0;

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

		ans+=dp[n][s];ans%=mod;

	}

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

	return 0;

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

#include <cstdio>

#include <cstring>

#define int long long

#define fre(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)

using namespace std;



inline int read(){

	int sum=0,f=1;char ch=getchar();

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

	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}

	return f*sum;

}



const int N=43;

const int M=1<<17;

const int Mod=1000000007;

int n,X,Y,Z,ans=1,lim,st;

int f[N][M];



signed main(){

	n=read();

	X=read();Y=read();Z=read();

	st|=1<<(Z-1);

	st|=1<<(Y+Z-1);

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

	lim=(1<<(X+Y+Z))-1;

	f[0][0]=1;

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

		ans=ans*10%Mod;

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

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

				int ret=((j<<k)|(1<<(k-1)))&lim;

				if((ret&st)!=st) f[i][ret]=(f[i][ret]+f[i-1][j])%Mod;

			}

		}	   

	}

	for(int j=0;j<lim;j++) ans=(ans-f[n][j])%Mod;

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

	return 0;

}


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

#include<cstring>

#include<cstdio>

#define ll long long

#define qwq

const int mod=1e9+7;

int dp[50][(1<<17)+7];

int n,x,y,z;

ll all_ans=1;

int main(){

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

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

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

	dp[0][0]=1;

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

		all_ans*=10;

		all_ans%=mod;

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

			if((s&gdans)==gdans)continue;

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

				int k=((s<<c)|(1<<(c-1)))&limit;

				if((k&gdans)==gdans)continue;

				dp[i][k]+=dp[i-1][s];

				dp[i][k]%=mod;

			}

		}

	}

	ll ans=0;

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

		ans+=dp[n][s];ans%=mod;

	}

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

	return 0;

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

using namespace std;

const long long N=40+2,MAX=(1<<17)+10,MOD=1e9+7;

long long n,x,y,z,f[N][MAX],sum=1,tot,cnt,ans;

void init(){

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

}

void work(){

	for(int i=0;++i<=n;(sum*=10)%=MOD);

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

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

	f[0][0]=1;

	for(int i=0;++i<=n;) for(int j=-1;++j<=cnt;) for(int h=0;++h<=10;

		ans=(j<<h)|(1<<h-1),ans&=cnt,(ans&tot)==tot?:(f[i][ans]+=f[i-1][j])%=MOD);

	for(int i=-1;++i<=cnt;((sum-=f[n][i])+=MOD)%=MOD);

}

void prin(){

	printf("%lld",sum);

}

int main(){

	init();

	work();

	prin();

	return 0;

}

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

#include<cstring>

#include<cstdio>

#define ll long long

#define qwq

const int mod=1e9+7;

int dp[50][(1<<17)+7];

int n,x,y,z;

ll all_ans=1;

int main(){

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

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

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

	dp[0][0]=1;

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

		all_ans*=10;

		all_ans%=mod;

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

			if((s&gdans)==gdans)continue;

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

				int k=((s<<c)|(1<<(c-1)))&limit;

				if((k&gdans)==gdans)continue;

				dp[i][k]+=dp[i-1][s];

				dp[i][k]%=mod;

			}

		}

	}

	ll ans=0;

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

		ans+=dp[n][s];ans%=mod;

	}

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

	return 0;

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

#define ll long long

using namespace std;

const ll N=42, Max=(1<<17)+10, MOD=1e9+7;

ll n, x, y, z, f[N][Max], sum=1, ans;

inline ll M(ll a){return a%MOD;}



void work(){

	for(int i = 0; i < n; i++) sum = M(sum*10);

	ll cnt = (1<<x+y+z) -1;

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

	f[0][0] = 1;

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

		for(int j = 0; j <= cnt; j++) 

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

				ans = (j<<h)|(1<<h-1);

				ans &= cnt;

				if((ans&tot)!=tot) f[i][ans] = M(f[i][ans]+f[i-1][j]);

			}

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

		sum = M(sum-f[n][i]+MOD);

}



int main(){

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

	work();

	printf("%lld",sum);

	return 0;

}

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

#define int long long

using namespace std; 

const int N=50,M=(1<<17)+5,mod=1e9+7; 

int n,x,y,z,st,dp[N][M],sum=1,k,ans;

signed main(){

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

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

	dp[0][0]=1;

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

		sum=sum*10%mod; 

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

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

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

					k=((S<<c)|(1<<(c-1)))&((1<<(x+y+z))-1);

					dp[i][k]=(dp[i][k]+dp[i-1][S])%mod;

				} 

	} 

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

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

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

	return 0;

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

#define ll long long

using namespace std;

const ll N=42, Max=(1<<17)+10, MOD=1e9+7;

ll n, x, y, z, f[N][Max], sum=1, ans;

inline ll M(ll a){return a%MOD;}



void work(){

	for(int i = 0; i < n; i++) sum = M(sum*10);

	ll cnt = (1<<x+y+z) -1;

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

	f[0][0] = 1;

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

		for(int j = 0; j <= cnt; j++) 

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

				ans = (j<<h)|(1<<h-1);

				ans &= cnt;

				if((ans&tot)!=tot) f[i][ans] = M(f[i][ans]+f[i-1][j]);

			}

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

		sum = M(sum-f[n][i]+MOD);

}



int main(){

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

	work();

	printf("%lld",sum);

	return 0;

}

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

using namespace std;

#define int long long

namespace Fread {

	const int MAXN=1<<20;

	char buf[MAXN],*S,*T;

	inline char getchar() {

		if (S==T) {

			T=(S=buf)+fread(buf,1,MAXN,stdin);

			if (S==T) return EOF;

		}

		return *S++;

	}

}

inline int read() {

	int x(0),neg(1);

	char ch=getchar();

	while(!isdigit(ch)) {

		if (ch=='-') neg=-1;

		ch=getchar();

	}

	while(isdigit(ch)) {

		x=(x<<1)+(x<<3)+(ch-'0');

		ch=getchar();

	}

	return x*neg;

}

#ifdef ONLINE_JUDGE

	#define getchar Fread::getchar

#endif

#define pb push_back

#define mp make_pair

int n,x,y,z;

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

const int mod=1e9+7;

inline int qpow(int x,int y) {

	int res=1ll;

	while(y) {

		if (y&1) res=res*x%mod;

		x=x*x%mod;

		y>>=1; 

	}

	return res;

} 

//130624

/*

int cnt;

inline void dfs(int sum) {

	if (sum>17) return ;

	++cnt;

	for (int i=1;i<=10;++i) dfs(sum+i);

}

*/

signed main() {

//	freopen(".in","r",stdin);

//	freopen(".out","w",stdout);

/*

	cnt=0;

	dfs(0);

	cout<<cnt<<'\n';

*/

	n=read(),x=read(),y=read(),z=read();

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

//	cout<<pnt<<'\n';

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

	int ans=qpow(10,n);

	dp[0][0]=1;

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

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

			if (dp[i-1][j]==0) continue;

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

				int now=((j<<k)+(1<<k-1))&tot;

				if ((now&pnt)!=pnt) {

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

				}

			}

		}

	}

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

		ans=(ans-dp[n][i]+mod)%mod;

	}

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

	return 0;

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

using namespace std;



#define mp make_pair

#define pb push_back



typedef long long ll;

typedef pair<int, int> ii;

typedef pair<ll, ll> l4;





const int maxn = 20;

int x, y, z;

int dp[2][1<<maxn] = {0};

int f = 0;

const int mod = 1e9+7;

inline void add(int &a, int b)

{

  a += b;

  if (a >= mod)

    a %= mod;

}

int n;

int mask;

bool work[1<<maxn] = {0};

int main()

{

  scanf("%d", &n);

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

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

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

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

    {

      work[i] = true;

      int tmp = i;

      while (tmp)

	{

	  if ((tmp&bit)==bit)

	    {

	      work[i] = false;

	      break;

	    }

	  tmp >>= 1;

	}

    }

  f = 0;

  dp[f][0] = 1;

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

    {

      f ^= 1;

      memset(dp[f], 0, (mask+1)*sizeof(int));

      for (int j = 0; j <= mask; ++j)

	if (work[j])

	  for (int d = 1; d <= 10; ++d)

	    {

	      int nxt = ((j<<1)|1)<<(d-1);

	      nxt &= mask;

	      if (work[nxt])

		add(dp[f][nxt], dp[f^1][j]);

	    }

    }

  int ans = 0;

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

    add(ans, dp[f][i]);

  ll tot = 1;

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

    tot = tot * 10 % mod;

  tot -= ans;

  tot %= mod;

  if (tot < 0)

    tot += mod;

  ans = tot;

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

  

    

      

}


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



const int MAXN = 40, MAXL = 17, MOD = 1e9 + 7;

int n, x, y, z, f[2][1 << MAXL];



inline void add_eq ( int& a, const int b ) { if ( ( a += b ) >= MOD ) a -= MOD; }



int main () {

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

	int all = ( 1 << x + y + z ) - 1, ans = 1;

	int haiku = ( 1 << x + y + z >> 1 ) | ( 1 << y + z >> 1 ) | ( 1 << z >> 1 );

	f[0][0] = 1;

	for ( int i = 0, t = 0; i < n; ++ i, t ^= 1, ans = ans * 10ll % MOD ) {

		for ( int s = 0; s <= all; ++ s ) {

			int& cur = f[t][s];

			if ( ! cur ) continue;

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

				trs = ( s << j | ( 1 << j >> 1 ) ) & all;

				if ( ( trs & haiku ) ^ haiku ) add_eq ( f[t ^ 1][trs], cur );

			}

			cur = 0;

		}

	}

	int sub = 0;

	for ( int i = 0; i <= all; ++ i ) add_eq ( sub, f[n & 1][i] );

	printf ( "%d\n", ( ans - sub + MOD ) % MOD );

	return 0;

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

#define rep(i,s,t) for (int i=s;i<=t;++i)

typedef long long ll;

const int mod=1e9+7;

const int maxn=1e5+10;

using namespace std;

int dp[42][(1<<17)+10];

int bit[20];

int main(){

    bit[0]=1;

    rep(i,1,19) bit[i]=bit[i-1]*2;

    int n,x,y,z;

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

    int t=x+y+z;

    int ans=bit[x-1]+bit[x+y-1]+bit[x+y+z-1];

    dp[0][0]=1;

    rep(i,0,n-1){

        rep(j,0,bit[t]-1){

            rep(k,1,10){

                int tmp=(((j<<k)+bit[k-1])&(bit[t]-1));

                if ((tmp&ans)!=ans)(dp[i+1][tmp]+=dp[i][j])%=mod;

            }

        }

    }

    int ret=1;

    rep(i,1,n) ret=ret*10ll%mod;

    rep(i,0,bit[t]-1) ret=(ret-dp[n][i]+mod)%mod;

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

}


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



const int MAXN = 40, MAXL = 17, MOD = 1e9 + 7;

int n, x, y, z, f[2][1 << MAXL];



inline void add_eq ( int& a, const int b ) { if ( ( a += b ) >= MOD ) a -= MOD; }



int main () {

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

	int all = ( 1 << x + y + z ) - 1, ans = 1;

	int haiku = ( 1 << x + y + z >> 1 ) | ( 1 << y + z >> 1 ) | ( 1 << z >> 1 );

	f[0][0] = 1;

	for ( int i = 0, t = 0; i < n; ++ i, t ^= 1, ans = ans * 10ll % MOD ) {

		for ( int s = 0; s <= all; ++ s ) {

			int& cur = f[t][s];

			if ( ! cur ) continue;

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

				trs = ( s << j | ( 1 << j >> 1 ) ) & all;

				if ( ( trs & haiku ) ^ haiku ) add_eq ( f[t ^ 1][trs], cur );

			}

			cur = 0;

		}

	}

	int sub = 0;

	for ( int i = 0; i <= all; ++ i ) add_eq ( sub, f[n & 1][i] );

	printf ( "%d\n", ( ans - sub + MOD ) % MOD );

	return 0;

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

using namespace std;



const int N = 45;

const int M = (1 << 17) + 10;

const int MOD = 1e9 + 7;



int n, x, y, z;

int f[N][M];



void add(int &x,int y) { x = x + y < MOD ? x + y : x + y - MOD; }



int main() {

	ios_base::sync_with_stdio(false);

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

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

	int endmask = 1 << (x + y + z);

	

	f[0][0] = 1;

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

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

			if (f[i - 1][mask] == 0) continue;

			

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

				if (mask == endmask) {

					add(f[i][mask], f[i - 1][mask]);

					continue;

				}

				

				int nmask = ((mask << nxt) | (1 << (nxt - 1))) & (endmask - 1);

				if ((nmask & needmask) == needmask) nmask = endmask;

				add(f[i][nmask], f[i - 1][mask]);

			}

		}

	}

	cout << f[n][endmask];

}

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



const int MAXN = 40, MAXL = 17, MOD = 1e9 + 7;

int n, x, y, z, f[2][1 << MAXL];



inline void add_eq ( int& a, const int b ) { if ( ( a += b ) >= MOD ) a -= MOD; }



int main () {

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

	int all = ( 1 << x + y + z ) - 1, ans = 1;

	int haiku = ( 1 << x + y + z >> 1 ) | ( 1 << y + z >> 1 ) | ( 1 << z >> 1 );

	f[0][0] = 1;

	for ( int i = 0, t = 0; i < n; ++ i, t ^= 1, ans = ans * 10ll % MOD ) {

		for ( int s = 0; s <= all; ++ s ) {

			int& cur = f[t][s];

			if ( ! cur ) continue;

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

				trs = ( s << j | ( 1 << j >> 1 ) ) & all;

				if ( ( trs & haiku ) ^ haiku ) add_eq ( f[t ^ 1][trs], cur );

			}

			cur = 0;

		}

	}

	int sub = 0;

	for ( int i = 0; i <= all; ++ i ) add_eq ( sub, f[n & 1][i] );

	printf ( "%d\n", ( ans - sub + MOD ) % MOD );

	return 0;

}