// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; ++i)
#define pop pap
const int N = 45, K = 17, mod = (int) 1e9 + 7;
int pw[N], dp[N][K + 1][1 << K], haiku[K + 1][1 << K], tlen[1 << K][K + 1][K + 1], tmask[1 << K][K + 1][K + 1], pop[1 << K];
void sadd(int &x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, x, y, z;
    cin >> n >> x >> y >> z;
    pw[0] = 1;
    for (int i = 1; i < N; ++i)
        pw[i] = pw[i - 1] * 1ll * 10 % mod;
    for (int mask = 0; mask < (1 << (x + y + z)); ++mask) {
        haiku[x + y + z][mask] = (mask >> (x - 1) & 1) & (mask >> (x + y - 1) & 1) & (mask >> (x + y + z - 1) & 1);
    }
    for (int mask = 0; mask < (1 << K); ++mask)
        pop[mask] = pop[mask >> 1] + pop[mask & 1];
    for (int len = 0; len <= x + y + z; ++len)
        for (int dig = 1; dig <= 10; ++dig)
            for (int lmask = 0; lmask < (1 << len); ++lmask) if (!len || lmask >> (len - 1) & 1) {
                if (dig > x + y + z) {
                    tlen[lmask][dig][len] = 0;
                    tmask[lmask][dig][len] = 0;
                    continue;
                }
                int nwlen = dig + len, mask = (lmask << dig) | (1 << (dig - 1));
                while (nwlen > x + y + z) {
                    mask -= 1 << (nwlen - 1);
                    for (int j = nwlen - 1; j >= 0; --j)
                        if (mask >> j & 1) {
                            nwlen = j + 1;
                            break;
                        }
                }
                tlen[lmask][dig][len] = nwlen;
                tmask[lmask][dig][len] = mask;

            }
    int l = x + y + z;
    dp[0][0][0] = 1;
    int res = 0;
    for (int dig = 1; dig <= n; ++dig) {
        //        cout << dig << endl;
        res = 10LL * res % mod;

        for (int len = 0; len <= l; ++len) {
            for (int lmask = len? (1 << len - 1): 0; lmask < (1 << len); ++lmask) if (dp[dig - 1][len][lmask] && pop[lmask] <= dig - 1) {
                for (int cur_dig = 1; cur_dig <= 10; ++cur_dig) {
                    int to_mask = tmask[lmask][cur_dig][len], to_len = tlen[lmask][cur_dig][len];
                    //                    for (int has = 0; has < 2; ++has) {
                    if (haiku[to_len][to_mask]) {
                        sadd(res, dp[dig - 1][len][lmask]);
                    } else {
                        sadd(dp[dig][to_len][to_mask], dp[dig - 1][len][lmask]);
                    }
                    //                    }
                }
            }
        }
    }
    /*    int res = 0;
          for (int len = 0; len <= l; ++len)
          for (int mask = 0; mask < (1 << len); ++mask) {
          if (0 && dp[n][len][mask][1]) {
          cout << n << ' ' << len << ' ' << mask << ' ' << haiku[len][mask] << endl;
          for (int i = 0; i < len; ++i)
          cout << (mask >> i & 1);
          cout << endl << endl;
          }
          sadd(res, dp[n][len][mask][1]);
          } */
    cout << res << endl;


}








Measured memory_bytes: 353408