#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define sz(x) (int)(x.size())
#define lt(x) (int)(x.length())
#define MOD 1000000007 
#define mx 100003

long long dep[10][10][10][50];

long long dp(int x, int y, int z, int sisa){
	if(sisa == 0 && x + y + z == 0)
		return 1;
	if(sisa == 0)
		return 0;
	long long &ret = dep[x][y][z][sisa];
	if(ret != -1)
		return ret;
	ret = 0;
	if(x > 0){
		for(int i = 1; i <= x; i++){
			ret = (ret + dp(x - i, y, z, sisa - 1)) % MOD;
		}
	}
	else if(y > 0){
		for(int i = 1; i <= y; i++)
			ret = (ret + dp(0, y - i, z, sisa - 1)) % MOD;
	}
	else if(z > 0){
		for(int i = 1; i <= z; i++)
			ret = (ret + dp(0, 0, z - i, sisa - 1)) % MOD;
	}
	return ret;
}

vector<vector<int>> isi;
vector<int> ve;

void brute(int x, int y, int z, int sisa){
	if(x + y + z == 0 && sisa == 0){
		isi.pb(ve);
		return;
	}
	assert(sisa > 0);
	if(x > 0){
		for(int i = 1; i <= x; i++){
			if(dp(x - i, y, z, sisa - 1) > 0){
				ve.pb(i);
				brute(x - i, y, z, sisa - 1);
				ve.pop_back();	
			}
		}
	}
	else if(y > 0){
		for(int i = 1; i <= y; i++){
			if(dp(0, y - i, z, sisa - 1) > 0){
				ve.pb(i);
				brute(0, y - i, z, sisa - 1);
				ve.pop_back();
			}
		}
	}
	else if(z > 0){
		for(int i = 1; i <= z; i++){
			if(dp(0, 0, z - i, sisa - 1) > 0){
				ve.pb(i);
				brute(0, 0, z - i, sisa - 1);
				ve.pop_back();
			}
		}
	}
}


struct AhoCorasick {
	int trie[200000][10];
	int fail[200000];
	int saiz;
	int ptr;
	bool ya[200000];
	vector<int> g[200000];
	AhoCorasick() {
		memset(trie[0],-1,sizeof trie[0]);
		saiz = 0;
		memset(ya, false, sizeof ya);
		ptr = 0;
	}

	void add(vector<int> str) {
		int cur = 0;
		for(int i = 0 ; i < str.size() ; i++) {
			//checkChar(str[i]);
			int nex = str[i] - 1;
			if(trie[cur][nex] == -1) {
				trie[cur][nex] = ++saiz;
				memset(trie[saiz],-1,sizeof trie[saiz]);
			}
			cur = trie[cur][nex];
		}
		ya[cur] = true;
	}

	void build() {
		queue<int> q;
		fail[0] = 0;

		for(int i = 0 ; i < 10 ; i++)
			if(trie[0][i] == -1)
				trie[0][i] = 0;
			else {
				int nex = trie[0][i];
				fail[nex] = 0;
				q.push(nex);
			}

		while(!q.empty()) {
			int now = q.front();
			q.pop();

			for(int i = 0 ; i < 10 ; i++){
				if(trie[now][i] == -1)
					trie[now][i] = trie[fail[now]][i];
				else {
					int nex = trie[now][i];
					fail[nex] = trie[fail[now]][i];
					q.push(nex);
				}
			}
		}	
		for(int i = 1; i <= saiz; i++){
			g[fail[i]].pb(i);
		}
		dfs(0, false);
	}

	void dfs(int now, bool yes){
		yes |= ya[now];
		ya[now] = yes;
		for(int i : g[now])
			dfs(i, yes);
	}

} aho;

long long F[200000][50];

long long f(int now, int sisa){
	if(aho.ya[now])
		return 0;
	if(sisa == 0)
		return 1;
	long long &ret = F[now][sisa];
	if(ret != -1)
		return ret;
	ret = 0;
	for(int i = 0; i < 10; i++){
		ret = (ret + f(aho.trie[now][i], sisa - 1)) % MOD;
	}
	return ret;
}

int main(){
	reset(dep, -1);
	reset(F, -1);
	long long n, x, y, z;
	cin >> n >> x >> y >> z;
	for(int i = 1; i <= n; i++){
		brute(x, y, z, i);
	}
	for(auto x : isi){
		aho.add(x);
	}
	aho.build();
	long long jaw = 1;
	for(int i = 0; i < n; i++)
		jaw = jaw * 10 % MOD;
	jaw = jaw - f(0, n);
	jaw %= MOD;
	if(jaw < 0)
		jaw += MOD;
	cout << jaw << endl;
}

Measured memory_bytes: 89788