#include <bits/stdc++.h>
using namespace std;

template <int mod = (int)(1e9 + 7)>
struct ModInt {
  int x;
  constexpr ModInt() : x(0) {}
  constexpr ModInt(int64_t y)
      : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  constexpr ModInt &operator+=(const ModInt &p) noexcept {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator-=(const ModInt &p) noexcept {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt &operator*=(const ModInt &p) noexcept {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  constexpr ModInt &operator/=(const ModInt &p) noexcept {
    *this *= p.inverse();
    return *this;
  }
  constexpr ModInt operator-() const { return ModInt(-x); }
  constexpr ModInt operator+(const ModInt &p) const noexcept {
    return ModInt(*this) += p;
  }
  constexpr ModInt operator-(const ModInt &p) const noexcept {
    return ModInt(*this) -= p;
  }
  constexpr ModInt operator*(const ModInt &p) const noexcept {
    return ModInt(*this) *= p;
  }
  constexpr ModInt operator/(const ModInt &p) const noexcept {
    return ModInt(*this) /= p;
  }
  constexpr bool operator==(const ModInt &p) const noexcept { return x == p.x; }
  constexpr bool operator!=(const ModInt &p) const noexcept { return x != p.x; }
  constexpr ModInt inverse() const noexcept {
    int a = x, b = mod, u = 1, v = 0, t = 0;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  constexpr ModInt pow(int64_t n) const {
    ModInt res(1), mul(x);
    while (n) {
      if (n & 1) res *= mul;
      mul *= mul;
      n >>= 1;
    }
    return res;
  }
  friend constexpr ostream &operator<<(ostream &os, const ModInt &p) noexcept {
    return os << p.x;
  }
  friend constexpr istream &operator>>(istream &is, ModInt &a) noexcept {
    int64_t t = 0;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  constexpr int get_mod() { return mod; }
};

int n;
vector<int> v(3);
vector<vector<int>> memo, to;
vector<vector<ModInt<>>> dp;

ModInt<> solve();
inline int trail(int s) { return (s ? __builtin_ctz(s) : 32); }

int main() {
  cin >> n;
  for (auto &p : v) cin >> p;
  reverse(v.begin(), v.end());
  cout << solve() << endl;
  return 0;
}

ModInt<> solve() {
  ModInt<> res = ModInt<>(10).pow(n);
  {  // make memo
    memo.resize(1 << 16);
    for (int i = 0; i < (1 << 16); ++i) {
      int x = i;
      while (x) {
        memo[i].push_back(trail(x) + 1);
        x >>= memo[i].back();
      }
    }
    to.resize(1 << 16, vector<int>(11, -1));
    for (int i = 0; i < (1 << 16); ++i)
      for (int j = 1; j <= 10; ++j) {
        {  // check
          bool ch = 1;
          int len = memo[i].size(), sum = j, id = 0;
          if (sum == v[0]) id = 1, sum = 0;
          for (int k = 0; k < len; ++k) {
            sum += memo[i][k];
            if (sum > v[id]) break;
            if (sum == v[id]) {
              if (++id == 3) {
                ch = 0;
                break;
              }
              sum = 0;
            }
          }
          if (!ch) continue;
        }
        {  // calc next
          int id = 0, len = memo[i].size(), sum = j;
          while (id < len && sum + memo[i][id] <= 16) sum += memo[i][id++];
          to[i][j] = 0;
          while (id--) to[i][j] = ((to[i][j] << 1) + 1) << (memo[i][id] - 1);
          to[i][j] = ((to[i][j] << 1) + 1) << (j - 1);
        }
      }
  }
  dp.assign(n + 1, vector<ModInt<>>(1 << 16, 0));
  dp[0][0] = 1;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < (1 << 16); ++j)
      for (int k = 1; k <= 10; ++k)
        if (to[j][k] >= 0) dp[i + 1][to[j][k]] += dp[i][j];
  for (auto p : dp[n]) res -= p;
  return res;
}


Measured memory_bytes: 25088