//  Copyright 2020 Nikita Golikov

#include <bits/stdc++.h>

using namespace std;

using i64 = int64_t;
using ui64 = uint64_t;

#ifdef GOLIKOV
mt19937_64 rng(566);
#else
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#endif

template <typename T>
T rnd_helper(T from, T to, true_type) {
  return uniform_int_distribution<T>(from, to)(rng);
}

template <typename T>
T rnd_helper(T from, T to, false_type) {
  return uniform_real_distribution<T>(from, to)(rng);
}

template <typename T>
T rnd(T from, T to) {
  return rnd_helper(from, to, is_integral<T>{});
}

template <typename A, typename B, typename Cmp>
bool set_min(A &x, B const &y, Cmp &&cmp) {
  if (cmp(y, x)) {
    x = y;
    return true;
  }
  return false;
}

template <typename A, typename B>
bool set_min(A &x, B const &y) {
  return set_min(x, y, less<typename common_type<A, B>::type>{});
}

template <typename A, typename B>
bool set_max(A &x, B const &y) {
  return set_min(x, y, greater<typename common_type<A, B>::type>{});
}

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
                         tree_order_statistics_node_update>;

template <typename K, typename V>
using ordered_map = tree<K, V, less<K>, rb_tree_tag,
                         tree_order_statistics_node_update>;

//  https://codeforces.com/blog/entry/62393
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }

  size_t operator()(uint64_t x) const {
    static const uint64_t
        FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return static_cast<size_t>(splitmix64(x + FIXED_RANDOM));
  }
};

#ifdef __cpp_deduction_guides
template <typename F>
struct rec_fun {
  F fun;

  rec_fun(F&& fun_) : fun(std::forward<F>(fun_)) {}

  template <typename... Args>
  decltype(auto) operator()(Args&&... args) const {
    return fun(*this, std::forward<Args>(args)...);
  }
};
#endif

#ifdef __cpp_inline_variables
template <typename T>
inline constexpr auto type_min = numeric_limits<T>::min();

template <typename T>
inline constexpr auto type_max = numeric_limits<T>::max();
#endif

//  fast alloc
#if 0
int const MAX_MEM = 1e8;
int mpos = 0;
char mem[MAX_MEM];
void* operator new(size_t n) {
  mpos += n;
  return (void*)(mem + mpos - n);
}
void operator delete (void*) noexcept {}
#endif

//  pragmas
#if 0
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
#pragma GCC optimize("unroll-loops")
#endif

int main() {
#ifdef GOLIKOV
  assert(freopen("in", "rt", stdin));
  auto _clock_start = chrono::high_resolution_clock::now();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, x, y, z;
  cin >> n >> x >> y >> z;

  int const MAX = 10;
  int const MOD = (int) 1e9 + 7;
  auto add_self = [](int& x, int y) {
    x += y;
    if (x >= MOD) {
      x -= MOD;
    }
    return x;
  };

  auto ends = [&](int msk, int i, int val) {
    if (val < 0) {
      return 0;
    }
    int id = 0;
    if (i > 0) {
      id += x + 1;
    }
    if (i > 1) {
      id += y + 1;
    }
    id += val;
    return (msk >> id) & 1;
  };
  auto make_nxt = [&](int mask, int add) {
    int new_mask = 1;
    int id = 1;
    for (int sx = 1; sx <= x; ++sx) {
      new_mask ^= ends(mask, 0, sx - add) << id;
      ++id;
    }
    new_mask ^= ends(new_mask, 0, x) << id;
    id++;
    for (int sy = 1; sy <= y; ++sy) {
      new_mask ^= ends(mask, 1, sy - add) << id;
      id++;
    }
    new_mask ^= ends(new_mask, 1, y) << id;
    id++;
    for (int sz = 1; sz < z; ++sz) {
      new_mask ^= ends(mask, 2, sz - add) << id;
      id++;
    }
    return new_mask;
  };

  int ans = 0;
  queue<pair<int, int>> q;
  map<pair<int, int>, int> dp;
  q.emplace(0, 2);
  dp[{0, 2}] = 1;
  while (!q.empty()) {
    auto cur = q.front();
    auto have = cur.first;
    auto mask = cur.second;
    q.pop();
    auto ways = dp[cur];
    auto const reached = mask & 1;
    if (have == n) {
      if (reached) {
        add_self(ans, ways);
      }
      continue;
    }
    for (int nxt = 1; nxt <= MAX; ++nxt) {
      auto nxt_mask = make_nxt(mask >> 1, nxt);
      auto new_reached = reached || ends(mask >> 1, 2, z - nxt);
      auto new_cur = make_pair(have + 1, nxt_mask << 1 | new_reached);
      auto was = dp.count(new_cur);
      add_self(dp[new_cur], ways);
      if (!was) {
        q.push(new_cur);
      }
    }
  }
  cout << ans << '\n';

#ifdef GOLIKOV
  cerr << "Executed in " << chrono::duration_cast<chrono::milliseconds>(
      chrono::high_resolution_clock::now()
          - _clock_start).count() << "ms." << endl;
#endif
  return 0;
}


Measured memory_bytes: 11392