/// You just can't beat the person who never gives up
/// ICPC next year

///#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std ;
const int N = 3e5+5 ,mod = 1e9+7 ;

int n ,x ,y ,z ;
int mem[55][1<<18] ,mx = (1<<18)-1;
int solve(int i,int mask){
    if(mask>>x&1 && mask>>y&1 && mask>>z&1) return 0;
    if(i==n) return 1;
    int&ret = mem[i][mask] ;
    if(~ret) return ret ;
    ret = 0 ;
    for(int j=1;j<=10;++j) ret = (ret + solve(i+1,((mask<<j)|(1<<j))&mx))%mod ;
    return ret ;
}
int pwr(int m){
    int ret = 1 ;
    while(m--) ret = 10ll*ret%mod ;
    return ret ;
}
int main(){
    cin >> n >> x >> y >> z ;
    y += z ;
    x += y ;
    memset(mem,-1,sizeof mem);
    cout << (pwr(n) - solve(0,0) + mod)%mod ;
    return 0;
}
