#include <iostream>
using namespace std;

int dp[41][1<<18];
int main()
{
    int n, x, y, z; cin>>n>>x>>y>>z;
    const int mod=1e9+7;

    int xyz=(1<<x+y+z-1)|(1<<y+z-1)|(1<<z-1);
    int mask=(1<<x+y+z)-1;

    dp[0][0]=1;
    for(int i=0; i<n; ++i) {
        for(int j=1; j<=10; ++j) {
            for(int k=0; k<=mask; ++k) {
                int t=(k<<j|1<<j-1)&mask;
                if ((t&xyz)!=xyz)
                    (dp[i+1][t]+=dp[i][k])%=mod;
            }
        }
    }

    long res=1;
    for(int i=0; i<n; ++i) (res*=10)%=mod;
    for(int i=0; i<=mask; ++i) {
        res-=dp[n][i];
        (res+=mod)%=mod;
    }
    cout<<res<<endl;
}
