#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
#define mod 1000000007
typedef long long ll;
int n,X,Y,Z;
ll f[45][(1<<17)+50];
inline void upd(ll &x,ll y) {
	x=x+y; if(x>=mod) x-=mod;
}
int main() {
	scanf("%d%d%d%d",&n,&X,&Y,&Z);
	int mask=(1<<(X+Y+Z))-1,tt=(1<<(X+Y+Z-1))|(1<<(Y+Z-1))|(1<<(Z-1));
	f[0][0]=1;
	int i,s,j;
	ll ans=1;
	for(i=1;i<=n;i++) ans=ans*10%mod;
	for(i=0;i<n;i++) {
		for(s=0;s<=mask;s++) if(f[i][s]) {
			for(j=1;j<=10;j++) {
				int now=((s<<j)|(1<<(j-1)))&mask;
				if((now&tt)==tt) continue;
				upd(f[i+1][now],f[i][s]);
			}
		}
	}
	for(s=0;s<=mask;s++) upd(ans,mod-f[n][s]);
	printf("%lld\n",ans);
}
