// Original C++ solution (slower):


 #include <cstdio>

#include <cstring>

#include <algorithm>

#include <queue>

#include <iostream>

#include <string>

#include <cmath>

#include <vector>

#include <set>

#include <map>

using namespace std;



#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)

#define MP make_pair

#define PB push_back

#define SZ(x) (int((x).size()))

#define ALL(x) (x).begin(), (x).end()

#define X first

#define Y second

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }

template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }



template <class T>  

inline bool RD(T &ret) {  

        char c; int sgn;  

        if (c = getchar(), c == EOF) return 0;  

        while (c != '-' && (c<'0' || c>'9')) c = getchar();  

        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  

        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  

        ret *= sgn;  

        return 1;  

}  

template <class T>  

inline void PT(T x) {  

        if (x < 0) putchar('-') ,x = -x;  

        if (x > 9) PT(x / 10);  

        putchar(x % 10 + '0');  

}



const int INF = 0x3f3f3f3f;

typedef long long LL;

typedef pair<int, int> pii;

typedef long double LD;





const LL MOD = 1e9 + 7;

LL dp[1 << 17][42];



int main() {

	LL ans = 0;

	int n, x, y, z;

	cin >> n >> x >> y >> z;

	int gmask = (1 << (x + y + z - 1)) | (1 << (z + y - 1)) | (1 << (z - 1));

	int m = 1 << (x + y + z);

	dp[0][0] = 1;

   	for(int i = 1; i <= n; i ++) {

		ans = 10 * ans % MOD;

		for(int mask = 0; mask < m; mask ++) {

			if((mask & gmask) == gmask) continue;

			for(int num = 1; num <= 10; num ++) {

				int nmask = ((mask << num) | (1 << (num - 1))) & (m - 1);

				if((nmask & gmask) == gmask) ans = (ans + dp[mask][i - 1]) % MOD;

				else dp[nmask][i] = (dp[nmask][i] + dp[mask][i - 1]) % MOD;

			}

		}

	}	

	cout << ans << endl;

}




// Optimized solution to the same problem (faster):


 #include <cstdio>

#include <cstring>

#include <algorithm>

#include <queue>

#include <iostream>

#include <string>

#include <cmath>

#include <vector>

#include <set>

#include <map>

using namespace std;



#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)

#define MP make_pair

#define PB push_back

#define SZ(x) (int((x).size()))

#define ALL(x) (x).begin(), (x).end()

#define X first

#define Y second

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }

template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }



template <class T>  

inline bool RD(T &ret) {  

        char c; int sgn;  

        if (c = getchar(), c == EOF) return 0;  

        while (c != '-' && (c<'0' || c>'9')) c = getchar();  

        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  

        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  

        ret *= sgn;  

        return 1;  

}  

template <class T>  

inline void PT(T x) {  

        if (x < 0) putchar('-') ,x = -x;  

        if (x > 9) PT(x / 10);  

        putchar(x % 10 + '0');  

}



const int INF = 0x3f3f3f3f;

typedef long long LL;

typedef pair<int, int> pii;

typedef long double LD;





const LL MOD = 1e9 + 7;

LL dp[1 << 17][42];



int main() {

	LL ans = 0;

	int n, x, y, z;

	cin >> n >> x >> y >> z;

	int gmask = (1 << (x + y + z - 1)) | (1 << (z + y - 1)) | (1 << (z - 1));

	int m = 1 << (x + y + z);

	dp[0][0] = 1;

   	for(int i = 1; i <= n; i ++) {

		ans = 10 * ans % MOD;

		for(int mask = 0; mask < m; mask ++) {

			if((mask & gmask) == gmask || dp[mask][i - 1] == 0) continue;

			for(int num = 1; num <= 10; num ++) {

				int nmask = ((mask << num) | (1 << (num - 1))) & (m - 1);

				if((nmask & gmask) == gmask) ans = (ans + dp[mask][i - 1]) % MOD;

				else dp[nmask][i] = (dp[nmask][i] + dp[mask][i - 1]) % MOD;

			}

		}

	}	

	cout << ans << endl;

}




// Fastest known solution for this problem: