#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  each(x,vec) is >> x;
  return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  rep(i,vec.size()) {
    if (i) os << " ";
    os << vec[i];
  }
  return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
  rep(i,vec.size()) {
    if (i) os << endl;
    os << vec[i];
  }
  return os;
}
const ll mod = 1e9+7;
ll mul(ll a, ll b) {
  return a * b % mod;
}
ll mul(initializer_list<ll> t) {
  ll res = 1;
  each(v, t) res = mul(res, v);
  return res;
}
ll add(ll a, ll b) {
  return (a + b) % mod;
}
ll add(initializer_list<ll> t) {
  ll res = 0;
  each(v, t) res = add(res, v);
  return res;
}
ll sub(ll a, ll b) {
  return (a - b + mod) % mod;
}
ll sub(initializer_list<ll> t) {
  auto it = t.begin();
  ll res = *(it++);
  while (it != t.end()) {
    res = sub(res, *(it++));
  }
  return res;
}
ll inv(ll n);
ll power(ll x, ll n) {
  if (n < 0) return inv(power(x, -n));
  ll res = 1;
  for (ll i = 1; i <= n; i <<= 1) {
    if (i & n) res = mul(res, x);
    x = mul(x, x);
  }
  return res;
}
ll inv(ll n) {
  return power(n, mod-2);
}
ll divi(ll a, ll b) {
  return mul(a, inv(b));
}
ll divi(initializer_list<ll> t) {
  auto it = t.begin();
  ll res = *(it++);
  while (it != t.end()) {
    res = divi(res, *(it++));
  }
  return res;
}
vector<ll> fact;
void init_fact(ll n) {
  fact.assign(n+1, 1);
  FOR(i, 1, fact.size()) {
    fact[i] = mul(fact[i-1], i);
  }
}

ll comb(ll n, ll r) {
  if (r < 0) return 0;
  if (r > n) return 0;
  return divi(fact[n], mul(fact[r], fact[n-r]));
}

using Row = vector<ll>;
using Matrix = vector<Row>;
Matrix E(ll n) {
  Matrix res(n, Row(n, 0));
  rep(i, n) res[i][i] = 1;
  return res;
}
Matrix mul(const Matrix& A, const Matrix& B) {
  const ll n = A.size(), m = A[0].size(), l = B[0].size();
  assert(m == B.size());
  Matrix res(n, Row(l, 0));
  rep(i, n) rep(j, m) rep(k, l) {
    res[i][k] = add(res[i][k], mul(A[i][j], B[j][k]));
  }
  return res;
}
Row mul(const Matrix& A, const Row& x) {
  Matrix tx(x.size());
  rep(i, x.size()) tx[i] = Row(1, x[i]);
  tx = mul(A, tx);
  Row res(x.size());
  rep(i, x.size()) res[i] = tx[i][0];
  return res;
}
Matrix power(Matrix A, ll n) {
  assert(A.size() == A[0].size());
  Matrix res = E(A.size());
  for (ll i = 1; i <= n; i <<= 1) {
    if (i & n) res = mul(res, A);
    A = mul(A, A);
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, a, b, c; cin >> n >> a >> b >> c;
  vector<ll> v{a, b, c};

  auto check = [&](const deque<ll>& d) {
    ll x = 0, cnt = 0;
    each(val, d) {
      cnt += val;
      if (cnt > v[x]) return 0;
      if (cnt == v[x]) {
        cnt = 0;
        if (++x == v.size()) return 2;
      }
    }
    return 1;
  };
  // map<deque<ll>, deque<ll>> memo;
  vector<map<deque<ll>, ll>> dp(n+1);
  dp[0][deque<ll>()] = 1;
  rep(i, n) each(p, dp[i]) rep(j, 1, 11) {
    deque<ll> nxt = p.first;
    nxt.pb(j);
    // if (memo.find(nxt) == memo.end()) {
    //   deque<ll> nxt0 = nxt;
      while (check(nxt) == 0) nxt.pop_front();
      // while (check(nxt0) == 0) {
      //   memo[nxt0] = nxt;
      //   nxt0.pop_front();
      // }
      // memo[nxt0] = nxt;
    // }
    // else {
    //   nxt = memo[nxt];
    // }
    if (check(nxt) != 2) {
      dp[i+1][nxt] = add(dp[i+1][nxt], p.second);
    }
  }
  ll ans = power(10, n);
  each(p, dp[n]) ans = sub(ans, p.second);
  cout << ans << endl;
}


Measured memory_bytes: 403328