#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<int mod>
struct ModInt{
    int x;

    ModInt() : x(0) {}
    
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    
    ModInt &operator+=(const ModInt &p){
        if((x += p.x) >= mod)   x -= mod;
        return *this;
    }
    
    ModInt &operator-=(const ModInt &p){
        if((x += mod - p.x) >= mod) x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p){
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p){
        *this *= p.inverse();
        return *this;
    }
    
    ModInt operator-() const {return ModInt(-x);}

    ModInt operator+(const ModInt &p) const {return ModInt(*this) += p;}

    ModInt operator-(const ModInt &p) const {return ModInt(*this) -= p;}

    ModInt operator*(const ModInt &p) const {return ModInt(*this) *= p;}

    ModInt operator/(const ModInt &p) const {return ModInt(*this) /= p;}

    bool operator==(const ModInt &p) const {return x == p.x;}

    bool operator!=(const ModInt &p) const {return x != p.x;}

    ModInt inverse() const{
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0){
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const{
        ModInt ret(1), mul(x);
        while(n > 0){
            if(n & 1)   ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p){
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a){
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() {return mod;}
};

using modint = ModInt<mod>;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int N;
    vector<int> X(3);
    cin >> N >> X[0] >> X[1] >> X[2];
    int M = X[0] + X[1] + X[2] - 1;
    const int MASKM = (1 << M) - 1;
    const int MASKS = (1 << (M + 1)) - 1;
    vector<vector<modint>> dp(2, vector<modint>(1 << M));
    dp[0][0] = 1;
    for(int loop = 0; loop < N; ++loop){
        for(int mask = 0; mask < (1 << M); ++mask)  dp[1][mask] = 0;
        for(int mask = 0; mask < (1 << M); ++mask){
            if(dp[0][mask] == 0)    continue;
            vector<int> pop_pos;
            for(int i = M - 1; i >= 0; --i){
                if(mask >> i & 1)   pop_pos.emplace_back(i);
            }
            pop_pos.emplace_back(-1);
            vector<int> val;
            for(int i = 0; i + 1 < (int)pop_pos.size(); ++i){
                val.emplace_back(pop_pos[i] - pop_pos[i + 1]);
            }
            for(int i = 0; i < 10; ++i){
                int nxt_mask = ((mask << (i + 1)) | (1 << i)) & MASKS;
                int cur = -1;
                bool flag = true;
                for(int j = 2; j >= 0; --j){
                    cur += X[j];
                    if(!(nxt_mask >> cur & 1)){
                        flag = false;
                        break;
                    }
                }
                if(flag)    continue;
                nxt_mask &= MASKM;
                dp[1][nxt_mask] += dp[0][mask];
            }
        }
        swap(dp[0], dp[1]);
    }

    modint ans = modint(10).pow(N);
    for(int mask = 0; mask < (1 << M); ++mask)  ans -= dp[0][mask];
    cout << ans << endl;
}

Measured memory_bytes: 3992