#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<iomanip>
#include<map>
#include<array>
#include<bitset>

#include<boost/multi_array.hpp>

typedef unsigned long long uint64;
typedef long long int64;
template<uint64 Mod>class mod_t
{
	uint64 val;
public:
	static constexpr auto mod = Mod;
	mod_t(uint64 v) :val(v%Mod)
	{

	}
	mod_t(int64 v) :val(v%Mod)
	{

	}
	mod_t(int v = 0) : val(v%Mod)
	{

	}
	mod_t(unsigned v) :val(v%Mod)
	{

	}

	uint64 operator*()const
	{
		return val;
	}
};
template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, mod_t<Mod> rhs)
{
	return (*lhs + *rhs);
}
template<uint64 Mod>mod_t<Mod> operator+(mod_t<Mod> lhs, int rhs)
{
	return (*lhs + rhs);
}
template<uint64 Mod>mod_t<Mod> operator+(int lhs, mod_t<Mod> rhs)
{
	return (lhs + *rhs);
}
template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, mod_t<Mod> rhs)
{
	return (*lhs - *rhs + Mod);
}
template<uint64 Mod>mod_t<Mod> operator-(mod_t<Mod> lhs, int rhs)
{
	return (*lhs - rhs + Mod);
}
template<uint64 Mod>mod_t<Mod> operator-(int lhs, mod_t<Mod> rhs)
{
	return (lhs - *rhs + Mod);
}
template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, mod_t<Mod> rhs)
{
	return (*lhs * *rhs);
}
template<uint64 Mod>mod_t<Mod> operator*(mod_t<Mod> lhs, int rhs)
{
	return (*lhs * rhs);
}
template<uint64 Mod>mod_t<Mod> operator*(int lhs, mod_t<Mod> rhs)
{
	return (lhs * *rhs);
}

typedef mod_t<1000000007> mod197;
template<class T>constexpr T pow(T val, int v)
{
	return 
		v == 0 ? T(1) :
		v == 1 ? val :
		v == 2 ? val*val :
		v % 2 == 0 ? pow(pow(val, v / 2), 2) :
		pow(pow(val, v / 2), 2)*val;
}

void Main();
int main()
{
	std::cin.sync_with_stdio(false);
	std::cout << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
	Main();
}

bool check(int v, int X, int Y, int Z)
{
	++v;
	std::array<int, 18> checker{};
	int n{};
	checker[0] = 1;
	while (v)
	{
		if (v % 2 == 0)
		{
			++checker.front();
		}
		else
		{
			for (int i = n;i >= 0;--i)
			{
				checker[i + 1] = checker[i];
			}
			checker[0] = 1;
			++n;
		}
		v /= 2;
	}
	for (int i = 1;i < n;++i)
	{
		int x = X, y = Y, z = Z;
		for (int k = i;k <= n;++k)
		{
			if (x)
			{
				if (x < checker[k])
					break;
				x -= checker[k];
			}
			else if (y)
			{
				if (y < checker[k])
					break;
				y -= checker[k];
			}
			else if(z)
			{
				if (z < checker[k])
					break;
				z -= checker[k];
			}
			else
			{
				break;
			}
		}
		if (x == 0 && y == 0 && z == 0)
			return true;
	}
	return false;
}
void Main()
{
	int N, X, Y, Z;
	std::cin >> N >> X >> Y >> Z;
	const int target = (1 << (X + Y + Z - 1)) + (1 << (Y + Z - 1)) + (1 << (Z - 1));
	const int cut = 1 << (X + Y + Z - 1);
	std::vector<mod197> memo(cut);
	std::vector<mod197> cache(cut);
	
	for (int i{};i < 10;++i)
	{
		int j = (1 << i) % (1 << X);
		memo[j] = memo[j] + 1;
	}
	for (int s = 1;s < N;++s)
	{
		cache.clear();
		cache.resize(cut);
		for (int i{};i < cut;++i)
		{
			for (int j{};j < 10;++j)
			{
				int next = (i << (j + 1)) + (1 << j);
				if ((next&target) != target)
				{
					cache[next%cut] = cache[next%cut] + memo[i];
				}
			}
		}
		std::swap(cache, memo);
	}
	mod197 result{};
	for (auto v : memo)
	{
		result = result + v;
	}
	std::cout << *(pow(mod197(10), N) - result) << std::endl;
}

Measured memory_bytes: 1280