#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

struct PMA { //MP with many strings, trie based. just change D.
	const int NL = 11; //change the # of letters
	const int base = 0;
	vector<vi> G;
	vector<int> D; //is end of string i
	vector<int> B; //when unmatched.
	int M;

	int new_node() {
		G.pb(vi(NL, -1)); D.pb(0); B.pb(0);
		return M++;
	}
	vi merge(const vi &a, const vi &b) {
		vi res;
		set_union(all(a), all(b), back_inserter(res));
		return res;
	}
	PMA() {
		M = 0; G.clear(); D.clear(); B.clear(); new_node();
	}
	void buildPMA(const vector<vi>& pattern) {
		rep(i, 0, sz(pattern)) {
			int v = 0;
			rep(j, 0, sz(pattern[i])) {
				int y = pattern[i][j] - base;
				if(G[v][y] == -1) {
					G[v][y] = new_node();
				}
				v = G[v][y];
			}
			D[v] = 1;
		}
		queue<int> que;
		rep(i, 0, NL) {
			if(G[0][i] == -1) G[0][i] = 0;
			else {
				B[G[0][i]] = 0;
				que.push(G[0][i]);
			}
		}
		while(!que.empty()) {
			int v = que.front(); que.pop();
			rep(i, 0, NL) {
				if(G[v][i] != -1) {
					int n = B[v];
					while(G[n][i] == -1) n = B[n];
					B[G[v][i]] = G[n][i];
					D[G[v][i]] |= D[G[n][i]];
					que.push(G[v][i]);
				}
			}
		}
	}
	void show(int v = 0) {
		debug(v, B[v], D[v]);
		rep(i, 0, NL) {
			if(G[v][i] != -1 && G[v][i] != v) show(G[v][i]);
		}
	}
};

int N, X, Y, Z;

ll dp[50][50000];

void solve() {
	cin >> N >> X >> Y >> Z;
	auto make = [](int bit, int n) {
		vi res;
		int at = 1;
		rep(i, 0, n - 1) {
			if(bit & (1 << i)) {
				res.pb(at);
				at = 1;
			}
			else at++;
		}
		res.pb(at);
		return res;
	};

	auto merge = [](vi v1, vi v2) {
		vi res = v1;
		rep(i, 0, sz(v2)) res.pb(v2[i]);
		return res;
	};

	vector<vi> pattern;
	rep(bit, 0, (1 << (X - 1))) {
		rep(cit, 0, (1 << (Y - 1))) {
			rep(dit, 0, (1 << (Z - 1))) {
				vi v1 = make(bit, X);
				vi v2 = make(cit, Y);
				vi v3 = make(dit, Z);
				vi vec = merge(merge(v1, v2), v3);
				pattern.pb(vec);
			}
		}
	}
	PMA pma;
	pma.buildPMA(pattern);
	dp[0][0] = 1;

	rep(i, 0, N) {
		rep(j, 0, sz(pma.G)) {
			rep(k, 1, 10 + 1) {
				if(!dp[i][j] || pma.D[j]) continue;
				int at = j;
				while(at != -1 && pma.G[at][k] == -1) {
					at = pma.B[at];
				}
				if(at == -1) at++;
				else at = pma.G[at][k];
				ADD(dp[i + 1][at], dp[i][j]);
			}
		}
	}
	ll res = 1;
	rep(i, 0, N) MUL(res, 10);
	rep(j, 0, sz(pma.G)) {
		if(!dp[N][j] || pma.D[j]) continue;
		ADD(res, mod - dp[N][j]);
	}
	cout << res << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 19636