//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>
 
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 40;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-12;
const double pi = atan2(0, -1);
const int ABC = 26;

ll bin_pow(ll a, ll p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            res = res * a % MOD;
        }
        a = a * a % MOD;
        p >>= 1;
    }
    return res;
}

vector<int> cur;
vector<vector<int> > good;
vector<int> SUM;
map<vector<int>, int> mapa;

bool check(vector<int> &a, int x, int y, int z) {
    /*for (int i : a) {
        cout << i << " ";
    }
    cout << endl;*/
    int n = sz(a);
    bool ok = true;
    rep(i, 0, n) {
        bool bad = true;
        int p = i, tmp = 0;
        while (p < n && tmp < x) {
            tmp += a[p++];
        }
        if (tmp != x) {
            bad = false;
        }
        tmp = 0;
        while (p < n && tmp < y) {
            tmp += a[p++];
        }
        if (tmp != y) {
            bad = false;
        }
        tmp = 0;
        while (p < n && tmp < z) {
            tmp += a[p++];
        }
        if (tmp != z) {
            bad = false;
        }
        if (bad) {
            ok = false;
            break;
        }
    }
    return ok;
}

int ans = 0;
int n;

void gen(int x, int y, int z, int sum) {
    vector<int> cur1 = cur;
    reverse(cur1.begin(), cur1.end());
    if (check(cur1, x, y, z)) {
        mapa[cur1] = sz(good);
        good.push_back(cur1);
        SUM.push_back(sum);
    }
    if (sum >= x + y + z) {
        return;
    }
    rep(c, 1, 10 + 1) {
        cur.push_back(c);
        gen(x, y, z, sum + c);
        cur.pop_back();
    }
}

vector<vector<int> > G;

inline void add(int &x, int y) {
    x += y;
    if (x >= MOD) {
        x -= MOD;
    }
}

int dp[40 + 1][610000];

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int x, y, z;
    cin >> n >> x >> y >> z;
    gen(x, y, z, 0);
    /*for (auto it : good) {
        for (int i : it) {
            cout << i << " ";
        }
        cout << endl;
    }*/
    //cout << sz(good) << endl;
    G.resize(sz(good));
    rep(i, 0, sz(good)) {
        vector<int> d = good[i];
        rep(c, 1, 10 + 1) {
            int s = c, p = sz(d);
            while (p - 1 >= 0 && s < x + y + z) {
                s += d[--p];
            }
            vector<int> tmp;
            rep(j, p, sz(d)) {
                tmp.push_back(d[j]);
            }
            tmp.push_back(c);
            auto it = mapa.find(tmp);
            if (it != mapa.end()) {
                G[i].push_back(it->se);
            }
        }
    }
    dp[0][0] = 1;
    rep(i, 0, n) {
        rep(j, 0, sz(good)) {
          	if (!dp[i][j]) {
            	continue; 
            }
            for (int k : G[j]) {
                add(dp[i + 1][k], dp[i][j]);
            }
        }
    }
    rep(i, 0, sz(good)) {
        add(ans, dp[n][i]);
    }
    cout << (bin_pow(10, n) - ans + MOD) % MOD << "\n";
    return 0;
}

Measured memory_bytes: 278564