#include <bits/stdc++.h>
 
#define rep(...) overload_rep(__VA_ARGS__, rep_1, rep_0)(__VA_ARGS__)
#define rep_0(i, end) for(int i = 0; i < (end); ++i)
#define rep_1(i, fr, ba) for(int i = (fr); i <= (ba); ++i)
#define overload_rep(arg0, arg1, arg2, name, ...) name
#define all(box) box.begin(), box.end()
 
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }

template <int MODULUS = 1000000007>
struct modulo_int {
private:

    long long value;
    constexpr void normalize() {
        value %= MODULUS;
        if (value < 0) value += MODULUS;
    }

public:

    constexpr modulo_int(const long long& value_ = 0) : value(value_) { normalize(); }
    constexpr modulo_int operator - () const { return modulo_int(MODULUS - value); }
    constexpr modulo_int operator ~ () const { return power(MODULUS - 2); }
    constexpr long long operator () () const { return value; }

    constexpr modulo_int operator + (const modulo_int& rhs) const { return modulo_int(*this) += rhs; }
    constexpr modulo_int& operator += (const modulo_int& rhs) {
        if ((value += rhs.value) >= MODULUS) value -= MODULUS;
        return (*this);
    }

    constexpr modulo_int operator - (const modulo_int& rhs) const { return modulo_int(*this) -= rhs; }
    constexpr modulo_int& operator -= (const modulo_int& rhs) {
        if ((value += MODULUS - rhs.value) >= MODULUS) value -= MODULUS;
        return (*this);
    }

    constexpr modulo_int operator * (const modulo_int& rhs) const { return modulo_int(*this) *= rhs; }
    constexpr modulo_int& operator *= (const modulo_int& rhs) {
        (value *= rhs.value) %= MODULUS;
        return (*this);
    }

    constexpr modulo_int operator / (const modulo_int& rhs) const { return modulo_int(*this) /= rhs; }
    constexpr modulo_int& operator /= (const modulo_int& rhs) {
        return (*this) *= ~rhs;
    }

    constexpr modulo_int power(const long long& power_) const {
        modulo_int result(1), mult(*this);
        for (long long t = power_; t > 0; t >>= 1) {
            if (t & 1) result *= mult;
            mult *= mult;
        }
        return result;
    }

    friend std::istream& operator >> (std::istream& stream, modulo_int& lhs) {
        stream >> lhs.value;
        lhs.normalize();
        return stream;
    }

    friend std::ostream& operator << (std::ostream& stream, const modulo_int& rhs) {
        return stream << rhs.value;
    }

};

using modint = modulo_int<>;
int N, X, Y, Z;
modint dp[41][1 << 18];

int main() {

    std::cin >> N >> X >> Y >> Z;
    Y += X; Z += Y;
    
    int bad = 1 + (1 << X) + (1 << Y) + (1 << Z);
    int mask = (1 << (Z + 1)) - 1;
    dp[0][1] = 1;

    rep (i, N) {
        rep (j, 1 << (Z + 1)) {
            rep (k, 1, 10) {
                int next = ((j << k) & mask) + 1;
                if ((next & bad) == bad) {
                    continue;
                }
                dp[i + 1][next] += dp[i][j];
            }
        }
    }

    modint sum;
    rep (j, 1 << (Z + 1)) {
        sum += dp[N][j];
    }
    std::cout << modint(10).power(N) - sum << '\n';

}


Measured memory_bytes: 82176