#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;


const int mod = 1000000007;
struct Mod {
public:
	int num;
	Mod() : Mod(0) { ; }
	Mod(long long int n) : num((n % mod + mod) % mod) {
		static_assert(mod<INT_MAX / 2, "mod is too big, please make num 'long long int' from 'int'");
	}
	Mod(int n) : Mod(static_cast<long long int>(n)) { ; }
	operator int() { return num; }
};

Mod operator+(const Mod a, const Mod b) { return Mod((a.num + b.num) % mod); }
Mod operator+(const long long int a, const Mod b) { return Mod(a) + b; }
Mod operator+(const Mod a, const long long int  b) { return b + a; }
Mod operator++(Mod &a) { return a + Mod(1); }
Mod operator-(const Mod a, const Mod b) { return Mod((mod + a.num - b.num) % mod); }
Mod operator-(const long long int a, const Mod b) { return Mod(a) - b; }
Mod operator--(Mod &a) { return a - Mod(1); }
Mod operator*(const Mod a, const Mod b) { return Mod(((long long)a.num * b.num) % mod); }
Mod operator*(const long long int a, const Mod b) { return Mod(a)*b; }
Mod operator*(const Mod a, const long long int b) { return Mod(b)*a; }
Mod operator*(const Mod a, const int b) { return Mod(b)*a; }
Mod operator+=(Mod &a, const Mod b) { return a = a + b; }
Mod operator+=(long long int &a, const Mod b) { return a = a + b; }
Mod operator-=(Mod &a, const Mod b) { return a = a - b; }
Mod operator-=(long long int &a, const Mod b) { return a = a - b; }
Mod operator*=(Mod &a, const Mod b) { return a = a * b; }
Mod operator*=(long long int &a, const Mod b) { return a = a * b; }
Mod operator*=(Mod& a, const long long int &b) { return a = a * b; }
Mod operator^(const Mod a, const int n) {
	if (n == 0) return Mod(1);
	Mod res = (a * a) ^ (n / 2);
	if (n % 2) res = res * a;
	return res;
}
Mod mod_pow(const Mod a, const long long  int n) {
	if (n == 0) return Mod(1);
	Mod res = mod_pow((a * a), (n / 2));
	if (n % 2) res = res * a;
	return res;
}
Mod inv(const Mod a) { return a ^ (mod - 2); }
Mod operator/(const Mod a, const Mod b) {
	assert(b.num != 0);
	return a * inv(b);
}
Mod operator/(const long long int a, const Mod b) {
	return Mod(a) / b;
}
Mod operator/=(Mod &a, const Mod b) {
	return a = a / b;
}

#define MAX_MOD_N 1024000

Mod fact[MAX_MOD_N], factinv[MAX_MOD_N];
void init(const int amax = MAX_MOD_N) {
	fact[0] = Mod(1); factinv[0] = 1;
	for (int i = 0; i < amax - 1; ++i) {
		fact[i + 1] = fact[i] * Mod(i + 1);
		factinv[i + 1] = factinv[i] / Mod(i + 1);
	}
}
Mod comb(const int a, const int b) {
	return fact[a] * factinv[b] * factinv[a - b];
}

vector<vector<Mod>>dp;
int main() {
	int N, X, Y, Z; cin >> N >> X >> Y >> Z;
	dp.resize(N + 1);
	for (int i = 0; i < N + 1; ++i) {
		dp[i].resize(1 << (X + Y + Z + 1));
	}
	dp[0][1] = true;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < (1 << (X+Y+Z+1)); ++j) {
			Mod num = dp[i][j];
			if (num.num) {
				bitset<20>bs(j);
				vector<int>xoks(X);
				vector<int>yoks(Y);
				vector<int>zoks(Z);
				bool finok = bs[X + Y + Z];
				for (int k = 0; k < X; ++k) {
					if (bs[k])xoks[k] = true;
				}
				for (int k = X; k < X + Y; ++k) {
					if (bs[k])yoks[k - X] = true;
				}
				for (int k = X + Y; k < X + Y + Z; ++k) {
					if (bs[k])zoks[k - X - Y] = true;
				}
				for (int next =1; next <= 10; ++next) {
					vector<int>nextxoks(X), nextyoks(Y), nextzoks(Z);
					bool nextfinok = finok;
					nextxoks[0] = true;
					for (int nx = 0; nx < X; ++nx) {
						if (xoks[nx]) {
							if (nx + next < X) {
								nextxoks[nx + next] = true;
							}
							else if (nx + next == X) {
								nextyoks[0] = true;
							}
						}
					}
					for (int ny = 0; ny < Y; ++ny) {
						if (yoks[ny]) {
							if (ny + next < Y) {
								nextyoks[ny + next] = true;
							}
							else if (ny + next == Y) {
								nextzoks[0] = true;
							}
						}
					}
					for (int nz = 0; nz < Z; ++nz) {
						if (zoks[nz]) {
							if (nz + next < Z) {
								nextzoks[nz + next] = true;
							}
							else if (nz + next == Z) {
								nextfinok = true;
							}
						}
					}
					bitset<20> nextbs;
					for (int k = 0; k < X; ++k) {
						nextbs[k] = nextxoks[k];
					}
					for (int k = X; k < X + Y; ++k) {
						nextbs[k] = nextyoks[k - X];
					}
					for (int k = X + Y; k < X + Y + Z; ++k) {
						nextbs[k] = nextzoks[k - X - Y];
					}
					nextbs[X + Y + Z] = nextfinok;
					dp[i + 1][nextbs.to_ulong()] += dp[i][j];
				}
			}
			
		}
	}
	Mod ans = 0;
	for (int j = 0; j < (1 << (X + Y + Z+1)); ++j) {
		bitset<20>bs(j);
		if (bs[X + Y + Z]) {

			ans += dp[N][j];
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 50432