#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int N,X,Y,Z; cin >> N >> X >> Y >> Z;
	vector<LL> dp(1<<(X+Y+Z),0);
	dp[0] = 1;
	const LL mod = 1e9+7;
	repp(i,0,N){
		vector<LL> nx(1<<(X+Y+Z),0);
		repp(k,0,1<<(X+Y+Z)) repp(w,1,11){
			int a = (((k&((1<<X)-1))<<w)|(1<<(w-1)))&((1<<X)-1);
			int b = ((k&((1<<(X+Y))-(1<<(X-1))))<<w)&((1<<(X+Y))-(1<<X));
			int c = ((k&((1<<(X+Y+Z))-(1<<(X+Y-1))))<<w)&((1<<(X+Y+Z))-(1<<(X+Y)));
			(nx[a^b^c|(k&(1<<(X+Y+Z-1)))] += dp[k]) %= mod;
		}
		swap(dp,nx);
	}
	LL ans = 0;
	repp(k,1<<(X+Y+Z-1),1<<(X+Y+Z)) (ans += dp[k]) %= mod;
	cout << ans << endl;
	return 0;
}
