// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define ll long long

#define ull unsigned long long

//#define db double

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

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

#define mem(x, y) memset(x, y, sizeof(x))

#define what_is(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << (x) << endl;

#define suf_zero(x) __builtin_ffs(x)

#define pre_zero(x) __builtin_clz(x)

#define num_one(x) __builtin_popcount(x)

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

#define mp make_pair

#define eb emplace_back

#define pb push_back

#define INFI 2000000009

#define INFLL (ll)1e18+7

#define fi first

#define se second

#define lson l, mid, rt<<1

#define rson mid+1, r, rt<<1|1

#define PII pair<int, int>

#define rep(i, begin, end) for(__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))

void err(istream_iterator<string> it) {cerr<<endl;}

template<typename T, typename... Args>

void err(istream_iterator<string> it, T a, Args... args) {

    cerr << *it << " = " << a << " , ";

    err(++it, args...);

}

#include<ext/pb_ds/assoc_container.hpp>

#include<ext/pb_ds/tree_policy.hpp>

#include<ext/pb_ds/hash_policy.hpp>

using namespace __gnu_pbds;

//mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());

//mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9+7;

ll qp(ll b, ll n, const int mod){ll r=1;b%=mod;if(n<0) n+=mod-1;for(;n;n>>=1, b=b*b%mod)if(n&1) r=r*b%mod;return r;}

//#define RG register

///////////// BOUND /////////////////

//tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> T;

namespace fastIO{

    #define BUF_SIZE 2000000

//     fread -> read

    bool IOerror = 0;

    static char obuf[BUF_SIZE], *OUT=obuf;

    inline char nc(){

        static char buf[BUF_SIZE], *p1 = buf+BUF_SIZE,

         *pend = buf+BUF_SIZE;

         if(p1==pend){

             p1 = buf;

             pend = buf+fread(buf, 1, BUF_SIZE, stdin);

             if(pend==p1){

                 IOerror = 1;

                 return -1;

             }

         }

         return *p1++;

    }

    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}

    inline int read(int &x){

        char ch;

        while(blank(ch=nc()));

        if(IOerror)return 0;

        for(x=ch-'0';(ch=nc())>='0'&&ch<='9';x=x*10+ch-'0');

        return 1;

    }

    inline int read(ll &x){

        char ch;

        while(blank(ch=nc()));

        if(IOerror)return 0;

        for(x=ch-'0';(ch=nc())>='0'&&ch<='9';x=x*10+ch-'0');

    }

    void print(const int& x) {

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

        *OUT++= x % 10 + '0';

    }

    void print(const ll& x) {

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

        *OUT++= x % 10 + '0';

    }

    void print(const char*s)

    {

        int len = strlen(s);

        for(int i=0;i<len;++i) *(OUT++) = s[i];

    }

    //void print(const __int128& x){if(x>9)print(x/10);putchar('0'+x%10);}

    void print(){fwrite(obuf, OUT-obuf, 1, stdout);}

    #undef BUF_SIZE

};

using namespace fastIO;

/////////////// MACRO ///////////////

ll dp[42][1<<18];

int main()

{

    int n, a, b, c;scanf("%d%d%d%d", &n, &a, &b, &c);

    const ll goal = ((((1<<a)+1)<<b)+1)<<c-1, sum = a+b+c;

    const ll m = 1<<sum;error(n, a, b, c);

    ll ans = 0;dp[0][0]=1;

    //for(int i=31;i>=0;--i)cout<<((goal>>i)&1);cout<<endl;

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

    {

        ans = ans*10%mod;

        for(ll j=0;j<m;++j)

        {

            //error(i, j, dp[i-1][j]);

            if((j&goal)==goal) ans = (ans+dp[i-1][j])%mod;

            else for(int k=1;k<=10;++k)

                (dp[i][(((j<<1)+1)<<(k-1))&(m-1)] += dp[i-1][j]) %=mod;

        }

    }

    cout << ans << endl;

}

// Faster C++ solution for the same problem (measured speedup: 1.894779493245603x):
#include <bits/stdc++.h>

const int N = 45, S = 1 << 18, mod = 1000000007;

int n, X, Y, Z, dp[N][S];

int ksm(int a,int b)

{

	int ans = 1;

	while(b)

	{

		if(b & 1) ans = 1LL * ans * a % mod;

		a = 1LL * a * a % mod;

		b >>= 1;

	}

	return ans;

}

int main()

{

	scanf("%d%d%d%d", &n, &X, &Y, &Z);

	dp[0][0] = 1;

	int G = X + Y + Z;

	int tmp = (1 << (X + Y + Z - 1)) | (1 << (Y + Z - 1)) | (1 << (Z - 1));

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

	{

		for(int s=0;s<(1<<G);s++) 

		{

			if(dp[i - 1][s])

			{

				for(int p=1;p<=10;p++)

				{

					int t = (s << p) | (1 << (p - 1));

					t &= ((1 << G) - 1);

					if(((t & tmp) != tmp))

						dp[i][t] = (dp[i][t] + dp[i - 1][s]) % mod;

				}

			}

		}

	}

	int res = 0;

	for(int s=0;s<(1<<G);s++) if((s & tmp) != tmp)

		res = (res + dp[n][s]) % mod;

	int powten = ksm(10, n); 

	printf("%d", (powten - res + mod) % mod);

}