#include<bits/stdc++.h>
#define ll long long
#define re register
#define ull unsigned ll
using namespace std;
inline int read(){
	int s=0,t=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')t=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*t;
}
const int N=41;
const int M=(1<<17)+5;
const int P=1e9+7;
int n,A,B,C,D,U,tr[M][11],f[N][M];
int Mod(int x){return x>=P?x-P:x;}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),A=read(),B=A+read(),C=B+read(),U=(1<<C);
	for(int S=1;S<=U;S++)
	for(int i=1;i<=10;i++){
		tr[S][i]=1;
		for(int j=0;j<=C;j++)if(S>>j&1){
			if(j<A&&j+i>A)continue;
			if(j<B&&j+i>B)continue;
			if(j+i<=C)tr[S][i]|=1<<(j+i);
		}if((S==U)||(tr[S][i]>=U))tr[S][i]=U;
	}f[0][1]=1;
	for(int i=1;i<=n;i++)
	for(int S=1;S<=U;S++)
	for(int j=1;j<=10;j++)f[i][tr[S][j]]=Mod(f[i][tr[S][j]]+f[i-1][S]);
	printf("%d",f[n][U]);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

constexpr Int mod = 1e9+7;
Int n, x, y, z;
vector<vector<Int>> dp;

bool ok(Int w){
	Int c = 0;
	for(Int j=0; (w>>j)>0; ++j)
		if((w>>j) & 1){
			if(j+1 == z) c += 4;
			if(j+1 == z+y) c += 2;
			if(j+1 == z+y+x) c += 1;
		}
	return c != 7;
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> x >> y >> z;
	dp.resize(n, vector<Int>(1<<(x+y+z)));
	for(Int i=1; i<=10; ++i){
		Int t = (1<<(i-1));
		t &= (1<<(x+y+z))-1;
		++dp[0][t];
	}
	for(Int i=0; i<n-1; ++i)
		for(Int j=0; j<(1<<(x+y+z)); ++j)
			for(Int k=1; k<=10; ++k){
//				cout << i << " " << j << " " << k << "\n";
				Int t = j;
				t <<= k;
				t |= (1<<(k-1));
				t &= (1<<(x+y+z))-1;
				if(ok(t)){
					dp[i+1][t] += dp[i][j];
					dp[i+1][t] %= mod;
				}
			}
	Int ans = 1;
	for(Int i=0; i<n; ++i){
		ans *= 10;
		ans %= mod;
	}
	for(Int i=0; i<(1<<(x+y+z)); ++i){
		ans -= dp[n-1][i];
		if(ans < 0) ans += mod;
	}
	cout << ans << "\n";
}