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

typedef long long LL;
const LL mod = 1000000007;

struct Node {
  int key;
  Node *f, *last, *ch[26];
  Node(): key(0), f(NULL), last(NULL) {
    memset(ch, 0, sizeof ch);
  }
} pool[100010];

int nno = 0;
Node* newNode() {
  pool[nno++] = Node();
  return pool + nno - 1;
}

struct AC {
  Node *root;
  AC() { root = NULL; }
  void init() { root = newNode(); }
  void insert(char *s, int key) {
    Node *cur = root;
    for(int i = 0; s[i]; ++i) {
      int idx = s[i] - 'a';
      if(!cur->ch[idx]) cur->ch[idx] = newNode();
      cur = cur->ch[idx];
    }
    cur->key = key;
  }
  void build() {
    queue<Node*> q;
    root->f = root->last = root;
    q.push(root);
    while(q.size()) {
      Node *x = q.front(); q.pop();
      for(int i = 0; i < 26; ++i) if(x->ch[i]) {
        Node *y = x->ch[i]; q.push(y);
        y->f = y->last = root;
        Node *t = x->f;
        while(t != root && !t->ch[i]) t = t->f;
        if(x != root) {
          y->f = t->ch[i] ? t->ch[i] : root;
          y->last = y->f->key ? y->f : y->f->last;
        }
      }
    }
  }

  int cnt[220]; //number of string
  void print(Node *x) {
    if(x->key) {
      cnt[x->key]++;
      print(x->last);
    }
  }
  void query(char *s) {
    Node *cur = root;
    for(int i = 0; s[i]; ++i) {
      int idx = s[i] - 'a';
      while(cur != root && !cur->ch[idx]) cur = cur->f;
      if(cur->ch[idx]) {
        cur = cur->ch[idx];
        if(cur->key) print(cur);
        else if(cur->last != root) print(cur->last);
      }
    }
  }
} sol;

LL dp[2][100010] = {};
int cur, nxt;
void jizz() {
  for (int i = 0; i < nno; ++i) {
    // if (dp[cur][i] == 0) continue;
    if (pool[i].key) {
      dp[nxt][i] += dp[cur][i] * 10 % mod;
      continue;
    }
    for (int idx = 0; idx < 10; ++idx) {
      Node *x = pool + i;
      while (x != sol.root && !x->ch[idx]) x = x->f;
      if (x->ch[idx]) {
        x = x->ch[idx];
      }
      dp[nxt][x - pool] += dp[cur][i];
      if (dp[nxt][x - pool] >= mod)
        dp[nxt][x - pool] -= mod;
    }
  }
}

int n, x, y, z;

bool ok(const vector<int> &a) {
  int tx = x, ty = y, tz = z;
  for (int t : a) {
    if (tx > 0) tx -= t;
    else if(ty > 0) ty -= t;
    else tz -= t;
  }
  return tx == 0 && ty == 0 && tz == 0;
}


char s[1234];
int main() {
  scanf("%d%d%d%d", &n, &x, &y, &z);
  int m = x + y + z - 1;
  int cnt = 0;
  sol.init();
  for (int i = 0; i < (1 << m); ++i) {
    int last = -1;
    vector<int> a;
    for (int j = 0; j < m; ++j) {
      if ((1 << j) & i) {
        a.push_back(j - last);
        last = j;
      }
    }
    a.push_back(m - last);
    if (a.size() > n) continue;
    if (ok(a)) {
      // for (int x : a) cout << x << ' '; cout << endl;
      for (int j = 0; j < a.size(); ++j) s[j] = 'a' + a[j] - 1;
      s[a.size()] = 0;
      sol.insert(s, 1);
      cnt++;
    }
  }
  sol.build();
  // printf("%d %d\n", cnt, nno);
 
  dp[0][0] = 1;
  cur = 0;
  
  while (n--) {
    nxt = cur ^ 1;
    memset(dp[nxt], 0, sizeof(dp[nxt]));
    jizz();
    cur = nxt;
  }

  LL ans = 0;
  for (int i = 0; i < nno; ++i)
    if (pool[i].key)
      ans = (ans + dp[cur][i]) % mod;

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 24576