macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
const MOD: i64 = 1_000_000_007;
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
struct Modi64(i64);
impl Modi64 {
    #[inline]
    fn new(i: i64) -> Modi64 {
        Modi64(Modi64::modulo(i, MOD))
    }
    #[inline]
    fn modulo(i: i64, m: i64) -> i64 {
        if i < 0 {
            i % m + m
        } else {
            i % m
        }
    }
    fn pow(self, y: i64) -> Modi64 {
        let mut y = Modi64(Modi64::modulo(y, MOD - 1));
        let mut x = 1.into();
        let mut base = self;
        while y.0 > 0 {
            if y.0 & 1 == 1 {
                x *= base;
            }
            base *= base;
            y = Modi64(y.0 >> 1);
        }
        x
    }
    #[inline]
    fn inv(self) -> Modi64 {
        self.pow(MOD - 2)
    }
}
impl From<i64> for Modi64 {
    fn from(i: i64) -> Modi64 {
        Modi64::new(i)
    }
}
impl std::ops::Add for Modi64 {
    type Output = Modi64;
    fn add(self, rhs: Modi64) -> Modi64 {
        (self.0 + rhs.0).into()
    }
}
impl std::ops::AddAssign for Modi64 {
    fn add_assign(&mut self, rhs: Modi64) {
        *self = *self + rhs;
    }
}
impl std::ops::Sub for Modi64 {
    type Output = Modi64;
    fn sub(self, rhs: Modi64) -> Modi64 {
        (self.0 - rhs.0).into()
    }
}
impl std::ops::SubAssign for Modi64 {
    fn sub_assign(&mut self, rhs: Modi64) {
        *self = *self - rhs;
    }
}
impl std::ops::Mul for Modi64 {
    type Output = Modi64;
    fn mul(self, rhs: Modi64) -> Modi64 {
        (self.0 * rhs.0).into()
    }
}
impl std::ops::MulAssign for Modi64 {
    fn mul_assign(&mut self, rhs: Modi64) {
        *self = *self * rhs;
    }
}
impl std::ops::Div for Modi64 {
    type Output = Modi64;
    fn div(self, rhs: Modi64) -> Modi64 {
        self * rhs.inv()
    }
}
impl std::ops::DivAssign for Modi64 {
    fn div_assign(&mut self, rhs: Modi64) {
        *self = *self / rhs;
    }
}
impl std::ops::Neg for Modi64 {
    type Output = Modi64;
    fn neg(self) -> Modi64 {
        (-self.0).into()
    }
}
impl std::iter::Sum for Modi64 {
    fn sum<I: Iterator<Item = Modi64>>(iter: I) -> Modi64 {
        iter.fold(0.into(), std::ops::Add::add)
    }
}
impl<'a> std::iter::Sum<&'a Modi64> for Modi64 {
    fn sum<I: Iterator<Item = &'a Modi64>>(iter: I) -> Modi64 {
        iter.fold(0.into(), |x, &y| x + y)
    }
}
fn main() {
    input! { l: chars };
    let l = l
        .into_iter()
        .map(|s| (s as u8 - '0' as u8) as usize)
        .collect::<Vec<_>>();
    let n = l.len();
    let mut dp = vec![vec![Modi64(0); 2]; n + 1];
    dp[0][0] = 1.into();
    for i in 0..n {
        for j in 0..2 {
            for a in 0..2 {
                for b in 0..2 {
                    let ni = i + 1;
                    let mut nj = j;
                    let d = dp[i][j];
                    if a == 1 && b == 1 {
                        continue;
                    }
                    if j == 0 {
                        if a + b < l[i] {
                            nj = 1;
                        } else if a + b > l[i] {
                            continue;
                        }
                    }
                    dp[ni][nj] += d;
                }
            }
        }
    }
    println!("{}", dp[n].iter().sum::<Modi64>().0);
}


Measured memory_bytes: 10492