use self::mod_int::ModInt;

const MOD: usize = 1_000_000_007;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n: usize = sc.read();
    let x: u64 = sc.read();
    let y: u64 = sc.read();
    let z: u64 = sc.read();
    let sum = (x + y + z) as usize;
    let mut dp = vec![ModInt(0); 1 << sum];
    dp[0] = ModInt(1);
    for _ in 0..n {
        let mut next = vec![ModInt(0); 1 << sum];
        for mask in 0..(1 << sum) {
            if dp[mask].0 == 0 {
                continue;
            }

            let mut cur = decode(mask as u64);
            let sum: u64 = cur.iter().sum();
            for add in 1..11 {
                cur.push(add);
                if contains_xyz(&cur, x, y, z) {
                    cur.pop();
                    continue;
                }

                let mut seq = cur.clone();
                cur.pop();
                let mut sum = sum + add;
                seq.reverse();
                while sum > x + y + z {
                    let removed = seq.pop().unwrap();
                    sum -= removed;
                }
                seq.reverse();
                let next_mask = encode(seq);
                next[next_mask as usize] += dp[mask];
            }
        }
        dp = next;
    }

    let mut ans = ModInt(0);
    for x in dp.iter() {
        ans += x.0;
    }
    let ans = ModInt(10).pow(n) - ans;
    println!("{}", ans.0);
}

fn contains_xyz(seq: &Vec<u64>, x: u64, y: u64, z: u64) -> bool {
    let xyz = vec![x, y, z];
    let mut i = 2;
    let mut cur = 0;
    for &a in seq.iter().rev() {
        if cur + a == xyz[i] {
            if i == 0 {
                return true;
            }
            i -= 1;
            cur = 0;
        } else if cur + a > xyz[i] {
            return false;
        } else {
            cur += a;
        }
    }
    false
}

fn decode(mut mask: u64) -> Vec<u64> {
    let mut result = vec![];
    while mask > 0 {
        let n = mask.trailing_zeros() as u64;
        result.push(n + 1);
        mask >>= n + 1;
    }
    result.reverse();
    result
}

fn encode(seq: Vec<u64>) -> u64 {
    let mut result = 0;
    for s in seq.into_iter() {
        result <<= s;
        result += 1 << (s - 1);
    }
    result
}

pub mod mod_int {
    use super::MOD;
    use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};

    type Num = usize;

    #[derive(Clone, Copy)]
    pub struct ModInt<T: Copy + Clone>(pub T);

    impl Add<ModInt<Num>> for ModInt<Num> {
        type Output = ModInt<Num>;
        fn add(self, rhs: ModInt<Num>) -> ModInt<Num> {
            self + rhs.0
        }
    }

    impl Add<Num> for ModInt<Num> {
        type Output = ModInt<Num>;
        fn add(self, rhs: Num) -> ModInt<Num> {
            let mut t = rhs + self.0;
            if t >= MOD {
                t = t - MOD;
            }
            ModInt(t)
        }
    }

    impl Sub<Num> for ModInt<Num> {
        type Output = ModInt<Num>;
        fn sub(self, rhs: Num) -> ModInt<Num> {
            let rhs = if rhs >= MOD { rhs % MOD } else { rhs };
            let value = if self.0 < rhs { self.0 + MOD } else { self.0 };
            ModInt(value - rhs)
        }
    }

    impl Sub<ModInt<Num>> for ModInt<Num> {
        type Output = ModInt<Num>;
        fn sub(self, rhs: ModInt<Num>) -> ModInt<Num> {
            self - rhs.0
        }
    }

    impl AddAssign<Num> for ModInt<Num> {
        fn add_assign(&mut self, other: Num) {
            *self = *self + other;
        }
    }
    impl AddAssign<ModInt<Num>> for ModInt<Num> {
        fn add_assign(&mut self, other: ModInt<Num>) {
            *self = *self + other;
        }
    }

    impl SubAssign<Num> for ModInt<Num> {
        fn sub_assign(&mut self, other: Num) {
            *self = *self - other;
        }
    }

    impl SubAssign<ModInt<Num>> for ModInt<Num> {
        fn sub_assign(&mut self, other: ModInt<Num>) {
            *self = *self - other;
        }
    }

    impl Div<Num> for ModInt<Num> {
        type Output = ModInt<Num>;
        fn div(self, rhs: Num) -> ModInt<Num> {
            self * ModInt(rhs).pow(MOD - 2)
        }
    }

    impl Div<ModInt<Num>> for ModInt<Num> {
        type Output = ModInt<Num>;
        fn div(self, rhs: ModInt<Num>) -> ModInt<Num> {
            self / rhs.0
        }
    }

    impl DivAssign<Num> for ModInt<Num> {
        fn div_assign(&mut self, rhs: Num) {
            *self = *self / rhs
        }
    }
    impl DivAssign<ModInt<Num>> for ModInt<Num> {
        fn div_assign(&mut self, rhs: ModInt<Num>) {
            *self = *self / rhs
        }
    }

    impl Mul<ModInt<Num>> for ModInt<Num> {
        type Output = ModInt<Num>;

        fn mul(self, rhs: ModInt<Num>) -> ModInt<Num> {
            self * rhs.0
        }
    }
    impl Mul<Num> for ModInt<Num> {
        type Output = ModInt<Num>;

        fn mul(self, rhs: Num) -> ModInt<Num> {
            let t = (self.0 * rhs) % MOD;
            ModInt(t)
        }
    }

    impl MulAssign<Num> for ModInt<Num> {
        fn mul_assign(&mut self, rhs: Num) {
            *self = *self * rhs;
        }
    }

    impl MulAssign<ModInt<Num>> for ModInt<Num> {
        fn mul_assign(&mut self, rhs: ModInt<Num>) {
            *self = *self * rhs;
        }
    }

    impl ModInt<Num> {
        pub fn pow(self, e: usize) -> ModInt<Num> {
            let mut result = ModInt(1);
            let mut cur = self;
            let mut e = e;
            while e > 0 {
                if e & 1 == 1 {
                    result *= cur;
                }
                e >>= 1;
                cur *= cur;
            }
            result
        }
    }
}
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 9464