// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
#define N 45
#define K 202020
int ten[ N ];
void build(){
  ten[ 0 ] = 1;
  for( int i = 1 ; i < N ; i ++ )
    ten[ i ] = mul( ten[ i - 1 ] , 10 );
}
int n , x , y , z , sum , mx , tcnt;
int vsum[ K ];
bool tag[ K ];
map< deque<int> , int > M;
deque<int> vv;
inline bool good(){
  int tsum = 0 , got = 0;
  for( size_t i = 0 ; i < vv.size() ; i ++ ){
    tsum += vv[ i ];
    if( got == 0 && tsum > x ) return false;
    else if( got == 0 && tsum == x ) tsum = 0 , got ++;
    else if( got == 1 && tsum > y ) return false;
    else if( got == 1 && tsum == y ) return true;
  }
  return true;
}
void gen( int tsum ){
  if( tsum > sum ) return;
  vsum[ tcnt ] = tsum;
  M[ vv ] = tcnt ++;
  if( tsum == sum ){
    if( good() ) tag[ tcnt - 1 ] = true;
    return;
  }
  for( int i = 1 ; i <= mx ; i ++ ){
    vv.push_back( i );
    gen( tsum + i );
    vv.pop_back();
  }
}
int nxt[ K ][ 11 ];
void init(){
  n = getint();
  x = getint();
  y = getint();
  z = getint();
  sum = x + y + z;
  mx = max( x , max( y , z ) );
  gen( 0 );
  for( auto it = M.begin() ; it != M.end() ; it ++ ){
    for( int i = 1 ; i <= mx ; i ++ ){
      vv = it->FI;
      int tmp = vsum[ it->SE ] + i;
      vv.push_back( i );
      while( tmp > sum ){
        tmp -= vv.front();
        vv.pop_front();
      }
      // assert( M.count( vv ) );
      nxt[ it->SE ][ i ] = M[ vv ];
    }
    for( int i = mx + 1 ; i <= 10 ; i ++ )
      nxt[ it->SE ][ i ] = 0;
  }
}
int dp[ N ][ K ];
bool inq[ N ][ K ];
void solve(){
  dp[ 0 ][ 0 ] = 1;
  queue< PII > Q;
  Q.push( { 0 , 0 } );
  int ans = 0;
  while( Q.size() ){
    PII tp = Q.front(); Q.pop();
    int xn = tp.FI , xp = tp.SE;
    if( tag[ xp ] ){
      ans = add( ans , mul( dp[ xn ][ xp ] , ten[ n - xn ] ) );
      continue;
    }
    if( xn == n ) continue;
    for( int i = 1 ; i <= 10 ; i ++ ){
      int nxtp = nxt[ xp ][ i ];
      dp[ xn + 1 ][ nxtp ] = add( dp[ xn + 1 ][ nxtp ] , dp[ xn ][ xp ] );
      if( !inq[ xn + 1 ][ nxtp ] ){
        inq[ xn + 1 ][ nxtp ] = true;
        Q.push( { xn + 1 , nxtp } );
      }
    }
  }
  printf( "%d\n" , ans );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 121600