#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cassert>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;
 
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

using mint = modint<mod>;
int n;
int x, y, z;

bool check(int j, int k) {
  if (k > z) return false;
  if (k != z) {
    int p = 1<<(z-k-1);
    if (!(j & p)) return false;
  }
  int q = 1<<(y+z-k-1);
  if (!(j&q)) return false;
  int r = 1<<(x+y+z-k-1);
  if (!(j&r)) return false;
  return true;
}

int shift(int j, int k, int mask) {
  int ret = j<<1;
  ret += 1;
  ret <<= (k-1);
  return ret&mask;
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> n >> x >> y >> z;
  int s = 1<<16;
  int mask = s-1;
  vector<mint> dp1(s);
  vector<mint> dp2(s);
  dp1[0] = 1;
  for(int i=1; i<=n; i++) {
    rep(j, s) {
      if (dp1[j].value() == 0) continue;
      for(int k=1; k<=10; k++) {
        if (!check(j, k)) {
          dp2[shift(j, k, mask)] += dp1[j];
        }
      }
    }
    rep(j, s) {
      dp1[j] = dp2[j];
      dp2[j] = 0;
    }
  }

  mint ans = 0;
  rep(i, s) {
    //if (dp1[i].value() > 0) {debug(i); debugln(dp1[i].value());}
    ans += dp1[i];
  }
  mint all = 1;
  rep(i, n) {
    all *= 10;
  }
  cout << (all-ans).value() << endl;
}

Measured memory_bytes: 1280