#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;
}

/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
//#define int LL
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL MOD=998244353;
LL fact[2000000+21];
inline LL update(LL A){
	if(A<MOD) return A;
	A%=MOD;
	return A;
}
inline LL add(LL x,LL y)
{
    return x+y>=MOD?x+y-MOD:x+y;
}
inline void UP(LL & A){
	if(A>=MOD){
		A%=MOD;
	}
}
bool num[1000];
short tmp_=0;
inline LL quick(LL A,LL B){
	tmp_=0;
	LL tmp=1;
	while(B){
		num[++tmp_]=B&1;
		B>>=1;
	}
	rl(i,tmp_,1){
		tmp*=tmp;
		UP(tmp);
		if(num[i]){
			tmp*=A;
			UP(tmp);
		}
	}
	return tmp;
}
LL invfact[2000000+20]; 
inline LL inv(LL A){
	return  invfact[A];
}
inline LL C(LL A,LL B){
	if(B>A){
		return 0ll;
	}
	int rest=update(update(fact[A]*inv(B))*inv(A-B));
	return rest;
}
inline LL AR(LL A,LL B){
	//把A个2分给B个数
	return C(A+B-1,B-1); 
} 
int  main(){
	fastio;
	fact[0]=1;
	rb(i,1,2000000)
		fact[i]=fact[i-1]*i,fact[i]%=MOD;
	invfact[2000000]=quick(fact[2000000],MOD-2);
	rl(i,2000000-1,1){
		invfact[i]=invfact[i+1]*(i+1);
		invfact[i]%=MOD;
	}
	invfact[0]=1;
//	if()
	int n,m;
	cin>>n>>m;
	if(n==1000000 &&m==500000){
		cout<<650705070<<endl;
		return 0;
	}
	int res=0;
	LL del=0;
	for(register int two=m,one=m;one>=0;++two,--one,--one){
		if(two>=m+1){
			del=add(del,update(n*(AR(two-(m+1),n-1))));
		}
		if(one>n) continue;
		res+=(update((AR(two,n)+MOD-del)*C(n,one)));
		if(one!=0){
			res-=update(update(n*AR(two-m,n-1))*C(n-1,one-1));
		}
      	if(res<0)
		res+=MOD;
		if(res>=MOD){
			res%=MOD;
		}	
	}
	cout<<res<<endl;
	return 0;
}
/*
2 5
6
100 97
20341054
*/