#![allow(unused_variables)]
#![allow(unused_must_use)]
use std::io::{self, prelude::*};

fn solve<R: BufRead, W: Write>(mut input: FastInput<R>, mut w: W) {
    let n = input.token();
    let k: usize = input.token();
    let mut c = vec![0usize; n];
    for x in c.iter_mut() {
        *x = input.token();
    }
    let a = c.iter().filter(|&&x| x == 0).count();

    let first_0 = |a, n, x| x;
    let first_1 = |a, n, x| a - x;
    let second_0 = |a, n, x| a - x;
    let second_1 = |a, n, x| n - a - second_0(a, n, x);
    let increase = |a, n, x| {
        let res = first_1(a, n, x) * second_0(a, n, x);
        (res + res) / n / (n - MOD7::identity())
    };
    let decrease = |a, n, x| {
        let res = first_0(a, n, x) * second_1(a, n, x);
        (res + res) / n / (n - MOD7::identity())
    };
    let same = |a, n, x| {
        let res = a * (a - MOD7::identity())
            + (n - a) * (n - a - MOD7::identity())
            + first_0(a, n, x) * second_0(a, n, x)
            + first_0(a, n, x) * second_0(a, n, x)
            + first_1(a, n, x) * second_1(a, n, x)
            + first_1(a, n, x) * second_1(a, n, x);
        res / n / (n - MOD7::identity())
    };

    let into = |x| MOD7::from(x as u32);
    let inc = |x| increase(into(a), into(n), into(x));
    let dec = |x| same(into(a), into(n), into(x));
    let eq = |x| decrease(into(a), into(n), into(x));

    let mut init: Matrix<MOD7> = Matrix::new(1, a + 1);
    *init.elem_mut(0, a - c[..a].iter().sum::<usize>()) = MOD7::identity();

    let mut transition: Matrix<MOD7> = Matrix::new(a + 1, a + 1);
    *transition.elem_mut(0, 0) = dec(0);
    if a > 0 {
        *transition.elem_mut(1, 0) = eq(1);
        *transition.elem_mut(a - 1, a) = inc(a - 1);
        *transition.elem_mut(a, a) = dec(a);
    }
    for i in 1..a {
        *transition.elem_mut(i - 1, i) = inc(i - 1);
        *transition.elem_mut(i, i) = dec(i);
        *transition.elem_mut(i + 1, i) = eq(i + 1);
    }
    let ans = init * binary_power(&transition, k as u64);
    let ans = ans.elem(0, a);
    write!(w, "{}\n", ans);
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    let input = FastInput::from(stdin.lock());
    let writer = io::BufWriter::new(stdout.lock());
    solve(input, writer);
}

trait TokenStream<T> {
    fn token(&mut self) -> T;
}

struct FastInput<R> {
    stdin: R,
    pos: usize,
}

impl<R: BufRead> From<R> for FastInput<R> {
    fn from(r: R) -> Self {
        FastInput { stdin: r, pos: 0 }
    }
}

impl<R: BufRead> TokenStream<u8> for FastInput<R> {
    fn token(&mut self) -> u8 {
        loop {
            if let Ok(buf) = self.stdin.fill_buf() {
                while self.pos < buf.len() {
                    self.pos += 1;
                    if buf[self.pos - 1] > 32 {
                        return buf[self.pos - 1];
                    }
                }
                if self.pos == 0 {
                    return 0;
                }
            } else {
                return 0;
            }
            self.stdin.consume(self.pos);
            self.pos = 0;
        }
    }
}

impl<R: BufRead> TokenStream<Vec<u8>> for FastInput<R> {
    fn token(&mut self) -> Vec<u8> {
        let mut ans = Vec::new();
        let mut parse_token = false;
        loop {
            if let Ok(buf) = self.stdin.fill_buf() {
                if !parse_token {
                    while self.pos < buf.len() && buf[self.pos] <= 32 {
                        self.pos += 1;
                    }
                }
                while self.pos < buf.len() && buf[self.pos] > 32 {
                    parse_token = true;
                    ans.push(buf[self.pos]);
                    self.pos += 1;
                }
                if self.pos != buf.len() || self.pos == 0 {
                    return ans;
                }
            }
            self.stdin.consume(self.pos);
            self.pos = 0;
        }
    }
}

macro_rules! impl_token_stream_u {
    ($($t:ident),+) => {$(
        impl<R: BufRead> TokenStream<$t> for FastInput<R> {
           fn token(&mut self) -> $t {
                let mut ans = 0;
                let mut parse_token = false;
                loop {
                    if let Ok(buf) = self.stdin.fill_buf() {
                        if !parse_token {
                            while self.pos < buf.len() && buf[self.pos] <= 32 {
                                self.pos += 1;
                            }
                        }
                        while self.pos < buf.len() && buf[self.pos] > 32 {
                            parse_token = true;
                            ans = ans * 10 + (buf[self.pos] - b'0') as $t;
                            self.pos += 1;
                        }
                        if self.pos != buf.len() || self.pos == 0 {
                            return ans;
                        }
                    }
                    self.stdin.consume(self.pos);
                    self.pos = 0;
                }
           }
        }
    )+}
}

pub trait Identity {
    fn identity() -> Self;
}

pub trait SelfIdentity {
    fn self_identity(&self) -> Self;
}

impl<T: Identity> SelfIdentity for T {
    fn self_identity(&self) -> Self {
        Self::identity()
    }
}

pub trait Inverse {
    fn inverse(self) -> Self;
}

macro_rules! define_modular_type {
    ($mod:ident, $value:expr) => {
        #[derive(Copy, Clone, Default, PartialEq)]
        struct $mod(u32);

        impl $mod {
            const MOD: u64 = $value;
        }

        impl std::fmt::Debug for $mod {
            fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
                write!(f, "{:?}", self.0)
            }
        }

        impl std::fmt::Display for $mod {
            fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
                write!(f, "{}", self.0)
            }
        }

        impl<T: Into<u64>> From<T> for $mod {
            fn from(a: T) -> Self {
                $mod((a.into() % Self::MOD) as u32)
            }
        }

        impl Into<u32> for $mod {
            fn into(self) -> u32 {
                self.0
            }
        }

        impl Identity for $mod {
            fn identity() -> Self {
                1u32.into()
            }
        }

        impl Inverse for $mod {
            fn inverse(self) -> Self {
                let mut t = (Self::default(), Self::identity());
                let mut r = (Self::MOD, self.0 as u64);
                while r.1 != 0 {
                    let q = r.0 / r.1;
                    t = (t.1, t.0 - t.1 * q.into());
                    r = (r.1, r.0 - r.1 * q);
                }
                t.0
            }
        }

        impl std::ops::Add for $mod {
            type Output = $mod;
            fn add(self, rhs: $mod) -> Self::Output {
                let mut ret = self.0 + rhs.0;
                if ret >= Self::MOD as u32 {
                    ret -= Self::MOD as u32;
                }
                $mod(ret)
            }
        }

        impl std::ops::AddAssign for $mod {
            fn add_assign(&mut self, rhs: Self) {
                self.0 += rhs.0;
                if self.0 >= Self::MOD as u32 {
                    self.0 -= Self::MOD as u32;
                }
            }
        }

        impl std::ops::Neg for $mod {
            type Output = Self;
            fn neg(self) -> Self::Output {
                $mod(Self::MOD as u32 - self.0)
            }
        }

        impl std::ops::Sub for $mod {
            type Output = $mod;
            fn sub(self, rhs: Self) -> Self::Output {
                if self.0 < rhs.0 {
                    $mod(self.0 + (Self::MOD as u32) - rhs.0)
                } else {
                    $mod(self.0 - rhs.0)
                }
            }
        }

        impl std::ops::SubAssign for $mod {
            fn sub_assign(&mut self, rhs: Self) {
                if self.0 < rhs.0 {
                    self.0 += Self::MOD as u32;
                }
                self.0 -= rhs.0
            }
        }

        impl std::ops::Mul for $mod {
            type Output = $mod;
            fn mul(self, rhs: Self) -> Self::Output {
                let a = self.0 as u64;
                let b = rhs.0 as u64;
                let c = a * b % Self::MOD;
                $mod(c as u32)
            }
        }

        impl std::ops::MulAssign for $mod {
            fn mul_assign(&mut self, rhs: Self) {
                *self = *self * rhs;
            }
        }

        impl std::ops::Div for $mod {
            type Output = Self;
            fn div(self, rhs: Self) -> Self::Output {
                self * rhs.inverse()
            }
        }

        impl std::ops::DivAssign for $mod {
            fn div_assign(&mut self, rhs: Self) {
                *self = *self / rhs;
            }
        }
    };
}

fn gcd<T>(mut a: T, mut b: T) -> T
where
    T: Copy + std::cmp::PartialEq + std::default::Default + std::ops::Rem<Output = T>,
{
    while b != T::default() {
        let r = a % b;
        a = b;
        b = r;
    }
    a
}

#[derive(Clone)]
pub struct Matrix<T> {
    data: Vec<T>,
    cols: usize,
    rows: usize,
}

impl<T> Matrix<T>
where
    T: std::default::Default + Clone,
{
    pub fn new(rows: usize, cols: usize) -> Matrix<T> {
        let data = vec![T::default(); cols * rows];
        Matrix {
            data: data,
            cols: cols,
            rows: rows,
        }
    }
}

impl<T> Matrix<T> {
    pub fn rows(&self) -> std::slice::Chunks<T> {
        self.data.chunks(self.cols)
    }
    pub fn rows_mut(&mut self) -> std::slice::ChunksMut<T> {
        self.data.chunks_mut(self.cols)
    }
    pub fn elem(&self, row: usize, col: usize) -> &T {
        &self.data[self.cols * row + col]
    }
    pub fn elem_mut(&mut self, row: usize, col: usize) -> &mut T {
        &mut self.data[self.cols * row + col]
    }
}

impl<T> std::fmt::Debug for Matrix<T>
where
    T: std::fmt::Debug,
{
    fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.rows()
            .try_for_each(|row| fmt.write_fmt(format_args!("{:?}\n", row)))
    }
}

impl<T> SelfIdentity for Matrix<T>
where
    T: Identity + std::default::Default + Clone,
{
    fn self_identity(&self) -> Self {
        assert_eq!(self.cols, self.rows);
        let mut ret = Matrix::new(self.rows, self.cols);
        for (i, row) in ret.rows_mut().enumerate() {
            row[i] = T::identity();
        }
        ret
    }
}

impl<T> std::ops::Add for Matrix<T>
where
    T: Clone + std::default::Default + std::ops::Add<Output = T>,
{
    type Output = Matrix<T>;
    fn add(self, rhs: Matrix<T>) -> Matrix<T> {
        assert_eq!(self.cols, rhs.cols);
        assert_eq!(self.rows, rhs.rows);
        Matrix {
            data: self
                .data
                .iter()
                .zip(rhs.data)
                .map(|(a, b)| a.clone() + b.clone())
                .collect(),
            rows: self.rows,
            cols: self.cols,
        }
    }
}
impl<T> std::ops::Sub for Matrix<T>
where
    T: Clone + std::default::Default + std::ops::Sub<Output = T>,
{
    type Output = Matrix<T>;
    fn sub(self, rhs: Matrix<T>) -> Matrix<T> {
        assert_eq!(self.cols, rhs.cols);
        assert_eq!(self.rows, rhs.rows);
        Matrix {
            data: self
                .data
                .iter()
                .zip(rhs.data)
                .map(|(a, b)| a.clone() - b.clone())
                .collect(),
            rows: self.rows,
            cols: self.cols,
        }
    }
}
impl<T> std::ops::Mul for Matrix<T>
where
    T: Clone + std::default::Default + std::ops::AddAssign + std::ops::Mul<Output = T>,
{
    type Output = Matrix<T>;
    fn mul(self, rhs: Matrix<T>) -> Matrix<T> {
        assert_eq!(self.cols, rhs.rows);
        let mut ret: Matrix<T> = Matrix::new(self.rows, rhs.cols);
        for (ret_row, self_row) in ret.rows_mut().zip(self.rows()) {
            for (rhs_row, self_el) in rhs.rows().zip(self_row) {
                for (ret_el, rhs_el) in ret_row.iter_mut().zip(rhs_row) {
                    *ret_el += self_el.clone() * rhs_el.clone();
                }
            }
        }
        ret
    }
}

fn binary_power<T>(a: &T, mut exp: u64) -> T
where
    T: Clone + std::ops::Mul<Output = T> + SelfIdentity,
{
    let mut base = a.clone();
    let mut acc = a.self_identity();
    while exp > 1 {
        if (exp & 1) == 1 {
            acc = acc * base.clone();
        }
        exp /= 2;
        base = base.clone() * base.clone();
    }
    if exp == 1 {
        acc = acc * base;
    }
    acc
}

impl_token_stream_u!(usize);
define_modular_type!(MOD7, 1_000_000_007);


/* This code was written by
Russell Emerine - linguist,
mathematician, coder,
musician, and metalhead. */

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}

impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            std::io::stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scanner = Scanner::default();
    let (h, w): (usize, usize) = (scanner.next(), scanner.next());
    let cake: Vec<Vec<_>> = (0..h)
        .map(|_| scanner.next::<String>().chars().map(|c| c == '*').collect())
        .collect();
    let (mut i, mut j) = (0, 0);
    let mut berries = if cake[i][j] { 1 } else { 0 };
    while j < w - 1 {
        if i < h - 1 && cake[i + 1][j] {
            i += 1;
            berries += 1;
        } else {
            j += 1;
            if cake[i][j] {
                berries += 1;
            }
        }
    }
    while i < h - 1 {
        i += 1;
        if cake[i][j] {
            berries += 1;
        }
    }
    println!("{}", berries);
}


#[allow(unused_imports)]
use std::cmp::{min,max};
//const INF: i32 = 0x3f3f3f3f;

struct Scanner {
    buffer: std::collections::VecDeque<String>
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            buffer: std::collections::VecDeque::new()
        }
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut input = String::new();
            std::io::stdin().read_line(&mut input).ok();
            self.buffer = input.split_whitespace()
                .map(ToString::to_string).collect();
        }
        let front = self.buffer.pop_front().unwrap();
        front.parse::<T>().ok().unwrap()
    }
}

fn main1() {
    let mut scan = Scanner::new();
    let n = scan.next::<i32>();
    let t = scan.next::<i32>();
    let k = scan.next::<i32>();
    let d = scan.next::<i32>();
    let t1 = ((n+k-1)/k) * t;
    let t2 = t1 - 1;
    let n2 = (t2/t + (t2-d)/t) * k;
    println!("{}", if n2 >= n { "YES" } else { "NO" } );
}

fn main() {
    std::thread::Builder::new().stack_size(50 << 20)
        .spawn(main1).unwrap().join().unwrap();
}


use std::io;
use std::str::FromStr;

fn get_nums() -> Vec<i32> {
	let mut input = String::new();

	io::stdin().read_line(&mut input)
		.expect("");

	input.trim()
		.split_whitespace()
		.map(|d| i32::from_str(d).unwrap())
		.collect::<Vec<_>>()
}

fn get_quad() -> (i32, i32, i32, i32) {
	let v = get_nums();

	(v[0], v[1], v[2], v[3])
}

fn main() {
 	let (n, t, mut k, d) = get_quad();

 	let mut t1 = 0;
 	let mut c = 0;

 	while c < n {
 		t1 += t;
 		c += k;
	}

	let mut t2 = d;
	c = 0;
	for _ in 0..d/t {
		c += k;
	}
	k *= 2;

	while c < n {
		t2 += t;
		c += k;
	}

	if t1 > t2 {
		println!("YES");
	} else {
		println!("NO");
	}
}


//spnauti-rust
#[allow(unused_macros)]
macro_rules! a {
    ($c: tt, $x: expr, $y: expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
use std::io::*;
use std::str::*;
use std::fmt::Debug;
struct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).unwrap();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    let a = input.vi(3);
    let b = input.vi(3);
    if (1..4).all(|n| a[..n].iter().sum::<i32>() <= b[..n].iter().sum()) {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;
use std::cmp::min;

fn main() {
    let mut required = readline_ints();
    let mut grapes = readline_ints();

    for i in 0..3 {
        // i can eat j
        for j in 0..(i+1) {
            let ate = min(grapes[j], required[i]);
            grapes[j] -= ate;
            required[i] -= ate;
        }
    }
    match required[0] + required[1] + required[2] {
        r if r == 0 => println!("YES"),
        _ => println!("NO")
    }
    //println!("{:?}", grapes);
}

fn readline_ints() -> Vec<i32> {
    let mut strs = String::new();
    let _ = io::stdin().read_line(&mut strs);
    strs.split_whitespace().map(|s| s.parse::<i32>().unwrap()).collect()
}


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      x: usize,
      y: usize,
      z: usize,
      a: usize,
      b: usize,
      c: usize,
    }

    if a < x {
        return println!("{}", "NO");
    }
    if (a-x) + b < y {
        return println!("{}", "NO");
    }
    if (a+b+c) < x+y+z {
        return println!("{}", "NO");
    }
    println!("{}", "YES");
}


use std::io;
fn main(){
    let mut line=String::new();
    io::stdin().read_line(&mut line).expect("Die");
    let arr:Vec<i32> = line.split(" ").map(|x| x.trim().parse().expect("Int")).collect();
    let (mut i,mut j):(i32,i32)=(arr[1],arr[3]);
    let mut ans=false;
    loop{
        i+=1;
        if i>arr[0]{
            i=1;
        }

        j-=1;
        if j<=0{
            j=arr[0];
        }
        if i==j{
            ans=true;
            break;
        }
        else if i==arr[2] || j==arr[4]{
            break;
        }
    }

    if ans{
        println!("YES")
    }
    else{
        println!("NO")
    }
}


pub trait Readable {
    type Output;
    fn words_count() -> usize;
    fn read_words(words: &[&str]) -> Result<Self::Output, String>;
}
#[macro_export]
macro_rules! readable {
    ( $ t : ty , $ words_count : expr , |$ words : ident | $ read_words : expr ) => {
        impl Readable for $t {
            type Output = $t;
            fn words_count() -> usize {
                $words_count
            }
            fn read_words($words: &[&str]) -> Result<$t, String> {
                Ok($read_words)
            }
        }
    };
}
readable!((), 1, |_ss| ());
readable!(String, 1, |ss| ss[0].to_string());
impl Readable for char {
    type Output = char;
    fn words_count() -> usize {
        1
    }
    fn read_words(words: &[&str]) -> Result<char, String> {
        let chars: Vec<char> = words[0].chars().collect();
        if chars.len() == 1 {
            Ok(chars[0])
        } else {
            Err(format!("cannot parse \"{}\" as a char", words[0]))
        }
    }
}
pub struct Chars();
impl Readable for Chars {
    type Output = Vec<char>;
    fn words_count() -> usize {
        1
    }
    fn read_words(words: &[&str]) -> Result<Vec<char>, String> {
        Ok(words[0].chars().collect())
    }
}
macro_rules ! impl_readable_for_ints { ( $ ( $ t : ty ) * ) => { $ ( impl Readable for $ t { type Output = Self ; fn words_count ( ) -> usize { 1 } fn read_words ( words : & [ & str ] ) -> Result <$ t , String > { use std :: str :: FromStr ; <$ t >:: from_str ( words [ 0 ] ) . map_err ( | _ | { format ! ( "cannot parse \"{}\" as {}" , words [ 0 ] , stringify ! ( $ t ) ) } ) } } ) * } ; }
impl_readable_for_ints ! ( i8 u8 i16 u16 i32 u32 i64 u64 isize usize f32 f64 ) ;
macro_rules ! define_one_origin_int_types { ( $ new_t : ident $ int_t : ty ) => { # [ doc = " Converts 1-origin integer into 0-origin when read from stdin." ] # [ doc = "" ] # [ doc = " # Example" ] # [ doc = "" ] # [ doc = " ```no_run" ] # [ doc = " # #[macro_use] extern crate atcoder_snippets;" ] # [ doc = " # use atcoder_snippets::read::*;" ] # [ doc = " // Stdin: \"1\"" ] # [ doc = " read!(a = usize_);" ] # [ doc = " assert_eq!(a, 0);" ] # [ doc = " ```" ] # [ allow ( non_camel_case_types ) ] pub struct $ new_t ( ) ; impl Readable for $ new_t { type Output = $ int_t ; fn words_count ( ) -> usize { 1 } fn read_words ( words : & [ & str ] ) -> Result < Self :: Output , String > { <$ int_t >:: read_words ( words ) . map ( | n | n - 1 ) } } } ; ( $ new_t : ident $ int_t : ty ; $ ( $ inner_new_t : ident $ inner_int_t : ty ) ;* ) => { define_one_origin_int_types ! ( $ new_t $ int_t ) ; define_one_origin_int_types ! ( $ ( $ inner_new_t $ inner_int_t ) ;* ) ; } ; }
define_one_origin_int_types ! ( u8_ u8 ; u16_ u16 ; u32_ u32 ; u64_ u64 ; usize_ usize ) ;
macro_rules ! impl_readable_for_tuples { ( $ t : ident $ var : ident ) => ( ) ; ( $ t : ident $ var : ident ; $ ( $ inner_t : ident $ inner_var : ident ) ;* ) => { impl_readable_for_tuples ! ( $ ( $ inner_t $ inner_var ) ;* ) ; impl <$ t : Readable , $ ( $ inner_t : Readable ) ,*> Readable for ( $ t , $ ( $ inner_t ) ,* ) { type Output = ( <$ t >:: Output , $ ( <$ inner_t >:: Output ) ,* ) ; fn words_count ( ) -> usize { let mut n = <$ t >:: words_count ( ) ; $ ( n += <$ inner_t >:: words_count ( ) ; ) * n } # [ allow ( unused_assignments ) ] fn read_words ( words : & [ & str ] ) -> Result < Self :: Output , String > { let mut start = 0 ; let $ var = <$ t >:: read_words ( & words [ start .. start +<$ t >:: words_count ( ) ] ) ?; start += <$ t >:: words_count ( ) ; $ ( let $ inner_var = <$ inner_t >:: read_words ( & words [ start .. start +<$ inner_t >:: words_count ( ) ] ) ?; start += <$ inner_t >:: words_count ( ) ; ) * Ok ( ( $ var , $ ( $ inner_var ) ,* ) ) } } } ; }
impl_readable_for_tuples ! ( T5 x5; T4 x4 ; T3 x3 ; T2 x2 ; T1 x1 ) ;
pub trait ReadableFromLine {
    type Output;
    fn read_line(line: &str) -> Result<Self::Output, String>;
}
fn split_into_words(line: &str) -> Vec<&str> {
    #[allow(deprecated)]
    line.trim_right_matches('\n').split_whitespace().collect()
}
impl<T: Readable> ReadableFromLine for T {
    type Output = T::Output;
    fn read_line(line: &str) -> Result<T::Output, String> {
        let words = split_into_words(line);
        if words.len() != T::words_count() {
            return Err(format!(
                "line \"{}\" has {} words, expected {}",
                line,
                words.len(),
                T::words_count()
            ));
        }
        T::read_words(&words)
    }
}
impl<T: Readable> ReadableFromLine for Vec<T> {
    type Output = Vec<T::Output>;
    fn read_line(line: &str) -> Result<Self::Output, String> {
        let n = T::words_count();
        let words = split_into_words(line);
        if words.len() % n != 0 {
            return Err(format!(
                "line \"{}\" has {} words, expected multiple of {}",
                line,
                words.len(),
                n
            ));
        }
        let mut result = Vec::new();
        for chunk in words.chunks(n) {
            match T::read_words(chunk) {
                Ok(v) => result.push(v),
                Err(msg) => {
                    let flagment_msg = if n == 1 {
                        format!("word {}", result.len())
                    } else {
                        let l = result.len();
                        format!("words {}-{}", n * l + 1, (n + 1) * l)
                    };
                    return Err(format!("{} of line \"{}\": {}", flagment_msg, line, msg));
                }
            }
        }
        Ok(result)
    }
}
impl<T: Readable, U: Readable> ReadableFromLine for (T, Vec<U>) {
    type Output = (T::Output, <Vec<U> as ReadableFromLine>::Output);
    fn read_line(line: &str) -> Result<Self::Output, String> {
        let n = T::words_count();
        #[allow(deprecated)]
        let trimmed = line.trim_right_matches('\n');
        let words_and_rest: Vec<&str> = trimmed.splitn(n + 1, ' ').collect();
        if words_and_rest.len() < n {
            return Err(format!(
                "line \"{}\" has {} words, expected at least {}",
                line,
                words_and_rest.len(),
                n
            ));
        }
        let words = &words_and_rest[..n];
        let empty_str = "";
        let rest = words_and_rest.get(n).unwrap_or(&empty_str);
        Ok((T::read_words(words)?, Vec::<U>::read_line(rest)?))
    }
}
macro_rules ! impl_readable_from_line_for_tuples_with_vec { ( $ t : ident $ var : ident ) => ( ) ; ( $ t : ident $ var : ident ; $ ( $ inner_t : ident $ inner_var : ident ) ;+ ) => { impl_readable_from_line_for_tuples_with_vec ! ( $ ( $ inner_t $ inner_var ) ;+ ) ; impl <$ t : Readable , $ ( $ inner_t : Readable ) ,+ , U : Readable > ReadableFromLine for ( $ t , $ ( $ inner_t ) ,+ , Vec < U > ) { type Output = ( $ t :: Output , $ ( $ inner_t :: Output ) ,+ , Vec < U :: Output > ) ; fn read_line ( line : & str ) -> Result < Self :: Output , String > { let mut n = $ t :: words_count ( ) ; $ ( n += $ inner_t :: words_count ( ) ; ) + # [ allow ( deprecated ) ] let trimmed = line . trim_right_matches ( '\n' ) ; let words_and_rest : Vec <& str > = trimmed . splitn ( n + 1 , ' ' ) . collect ( ) ; if words_and_rest . len ( ) < n { return Err ( format ! ( "line \"{}\" has {} words, expected at least {}" , line , words_and_rest . len ( ) , n ) ) ; } let words = & words_and_rest [ .. n ] ; let empty_str = "" ; let rest = words_and_rest . get ( n ) . unwrap_or ( & empty_str ) ; let ( $ var , $ ( $ inner_var ) ,* ) = < ( $ t , $ ( $ inner_t ) ,+ ) >:: read_words ( words ) ?; Ok ( ( $ var , $ ( $ inner_var ) ,* , Vec ::< U >:: read_line ( rest ) ? ) ) } } } ; }
impl_readable_from_line_for_tuples_with_vec ! ( T4 t4 ; T3 t3 ; T2 t2 ; T1 t1 ) ;
pub fn read<T: ReadableFromLine>() -> T::Output {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    T::read_line(&line).unwrap()
}
#[macro_export]
macro_rules ! read { ( ) => { let mut line = String :: new ( ) ; std :: io :: stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; } ; ( $ pat : pat = $ t : ty ) => { let $ pat = read ::<$ t > ( ) ; } ; ( $ ( $ pat : pat = $ t : ty ) ,+ ) => { read ! ( ( $ ( $ pat ) ,* ) = ( $ ( $ t ) ,* ) ) ; } ; }
#[macro_export]
macro_rules ! readls { ( $ ( $ pat : pat = $ t : ty ) ,+ ) => { $ ( read ! ( $ pat = $ t ) ; ) * } ; }
pub fn readx<T: ReadableFromLine>() -> Vec<T::Output> {
    use std::io::{self, BufRead};
    let stdin = io::stdin();
    let result = stdin
        .lock()
        .lines()
        .map(|line_result| {
            let line = line_result.expect("read from stdin failed");
            T::read_line(&line).unwrap()
        }).collect();
    result
}
#[macro_export]
macro_rules ! readx_loop { ( |$ pat : pat = $ t : ty | $ body : expr ) => { use std :: io :: BufRead ; let stdin = std :: io :: stdin ( ) ; for line in stdin . lock ( ) . lines ( ) { let line = line . expect ( "read from stdin failed" ) ; let $ pat = <$ t >:: read_line ( & line ) . unwrap ( ) ; $ body } } ; ( |$ ( $ pat : pat = $ t : ty ) ,*| $ body : expr ) => { readx_loop ! ( | ( $ ( $ pat ) ,* ) = ( $ ( $ t ) ,* ) | $ body ) ; } ; }
pub fn readn<T: ReadableFromLine>(n: usize) -> Vec<T::Output> {
    use std::io::{self, BufRead};
    let stdin = io::stdin();
    let result: Vec<T::Output> = stdin
        .lock()
        .lines()
        .take(n)
        .map(|line_result| {
            let line = line_result.expect("read from stdin failed");
            T::read_line(&line).unwrap()
        }).collect();
    if result.len() < n {
        panic!(
            "expected reading {} lines, but only {} lines are read",
            n,
            result.len()
        );
    }
    result
}
#[macro_export]
macro_rules ! readn_loop { ( $ n : expr , |$ pat : pat = $ t : ty | $ body : expr ) => { use std :: io :: BufRead ; let stdin = std :: io :: stdin ( ) ; { let mut lock = stdin . lock ( ) ; for _ in 0 ..$ n { let mut line = String :: new ( ) ; lock . read_line ( & mut line ) . expect ( "read from stdin failed" ) ; let $ pat = <$ t >:: read_line ( & line ) . unwrap ( ) ; $ body } } } ; ( $ n : expr , |$ ( $ pat : pat = $ t : ty ) ,*| $ body : expr ) => { readn_loop ! ( $ n , | ( $ ( $ pat ) ,* ) = ( $ ( $ t ) ,* ) | $ body ) ; } ; }
pub trait Words {
    fn read<T: Readable>(&self) -> T::Output;
}
impl<'a> Words for [&'a str] {
    fn read<T: Readable>(&self) -> T::Output {
        T::read_words(self).unwrap()
    }
}
impl<'a> Words for &'a str {
    fn read<T: Readable>(&self) -> T::Output {
        T::read_words(&[self]).unwrap()
    }
}

#[macro_export]
macro_rules! dbg {
    ( $ e : expr ) => {{
        use std::io::{self, Write};
        let result = $e;
        writeln!(
            io::stderr(),
            "{}: {} = {:?}",
            line!(),
            stringify!($e),
            result
        ).unwrap();
        result
    }};
}

pub fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}
#[allow(non_snake_case)]
pub fn YN(result: bool) {
    if result {
        println!("YES");
    } else {
        println!("NO");
    }
}

use std::iter::{once, repeat};

fn main() {
    read!(n = u16, a = u16_, x = u16_, b = u16_, y = u16_);
    let iter1 = (a..)
        .map(|i| i % n)
        .take_while(|&i| i != x)
        .chain(once(x));
    let iter2 = repeat((0..n).rev()).flatten()
        .skip_while(|&i| i != b)
        .take_while(|&i| i != y)
        .chain(once(y));
    let ans = iter1.zip(iter2).any(|(i, j)| i == j);
    YN(ans);
}


use std::io;

macro_rules! parse_line {
    ($($t: ty), +) => {{
        let mut a_line = String::new();
        io::stdin().read_line(&mut a_line).expect("read error");
        let mut a_line_iter = a_line.split_whitespace();
        (
            $(
                a_line_iter.next().unwrap().parse::<$t>().expect("parse error"),
            )+
        )
    }};
}

fn main() {
    let (n, mut a, x, mut b, y) = parse_line!(i32, i32, i32, i32, i32);
    let mut ok = false;
    loop {
        if a == b {
            ok = true;
        }
        if a == x || b == y {
            break;
        }
        match a == n {
            true => a = 1,
            false => a += 1,
        }
        match b == 1 {
            true => b = n,
            false => b -= 1,
        }
    }
    match ok {
        true => println!("YES"),
        false => println!("NO"),
    }
}


#![allow(unused_imports)]
use std::collections::{HashSet, HashMap};
use std::cmp::{min,max};
use std::io;
use std::str;

struct Scanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: str::SplitWhitespace<'static>,
}
impl<R: io::BufRead> Scanner<R> {
    fn new(reader: R) -> Self {
        Self { reader, buf_str: vec![], buf_iter: "".split_whitespace() }
    }
    fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            // If we have another token in this line
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse"); // calls parse::<T>() on the current token and returns it.
            }

            // If we do not have another token in the line then
            // we should go to the next line.
            self.buf_str.clear(); // empty out the buffer that holds the current line
            self.reader.read_until(b'\n', &mut self.buf_str).expect("Failed read"); // read a new line into the buffer

            // create an iterator over the white space delimited strings of the current line
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str); // makes a string from utf8 characters in the current line
                std::mem::transmute(slice.split_whitespace()) // transmutes the memory in place
            }
        }
    }
}

#[derive(PartialEq)]
enum Cube {
    Red,
    Blue
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let mut red = scan.token::<u32>();
    let mut blue = scan.token::<u32>();
    let mut last_cube: Option<Cube> = None;
    let mut petya = true;
    let mut petya_score: u32 = 0;
    let mut vasya_score: u32 = 0;

    if blue < red {
        if blue % 2 != 0 {
            last_cube = Some(Cube::Blue);
            blue -= 1;
        } else {
            last_cube = Some(Cube::Red);
            red -= 1;
        }
    } else if red < blue {
        if red % 2 != 0 {
            last_cube = Some(Cube::Red);
            red -= 1;
        } else {
            last_cube = Some(Cube::Blue);
            blue -= 1;
        }
    }

    while red > 0 || blue > 0 {
        let desired_color = {
            if petya {
                match last_cube {
                    Some(Cube::Red) => Cube::Red,
                    Some(Cube::Blue) => Cube::Blue,
                    None => Cube::Red
                }
            } else {
                match last_cube {
                    Some(Cube::Red) => Cube::Blue,
                    Some(Cube::Blue) => Cube::Red,
                    None => Cube::Red
                }
            }
        };

        let current_cube = {
            if desired_color == Cube::Red && red > 0 {
                red -= 1;
                Cube::Red
            } else if desired_color == Cube::Blue && blue > 0 {
                blue -=1;
                Cube::Blue
            } else if blue > 0 && red == 0 {
                blue -= 1;
                Cube::Blue
            } else {
                red -= 1;
                Cube::Red
            }
        };

        if let Some(last_cube) = last_cube {
            if last_cube == current_cube {
                petya_score += 1;
            } else {
                vasya_score += 1;
            }
        }

        last_cube = Some(current_cube);

        petya = !petya;
    }

    writeln!(out, "{} {}", petya_score, vasya_score);
}

fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());
    solve(&mut scan, &mut out);
}


//spnauti-rust
#[allow(unused_macros)]
macro_rules! a {
    ($c: tt, $x: expr, $y: expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
use std::io::*;
use std::str::*;
use std::fmt::Debug;
struct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).unwrap();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    let n = input.i();
    let m = input.i();
    println!("{}", m % (1 << n.min(30)));
}


fn main() {
    let n: i64 = readln();
    let m: i64 = readln();
    let ans = if n <= 32 { m % (1i64 << n) } else { m };
    println!("{}", ans);
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashSet;

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


#[allow(unused_imports)]
use std::cmp::{max,min};
#[allow(unused_imports)]
use std::collections::{HashMap,HashSet,VecDeque};

#[allow(unused_macros)]
macro_rules! readln {
    () => {{
        use std::io;

        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        buf.trim().to_string()
    }};
    ( $t:ty ) => {{
        let input = readln!();
        input.parse::<$t>().unwrap()
    }};
    ( $( $t:ty ),+ ) => {{
        let input = readln!();
        let mut input = input.split_whitespace();
        (
            $(
                input.next().unwrap().parse::<$t>().unwrap(),
            )+
        )
    }}
}

#[allow(unused_macros)]
macro_rules! readvec {
    ( $t:ty ) => {{
        let input = readln!();
        let mut input = input.split_whitespace();
        let mut result = Vec::new();
        for elem in input {
            result.push(elem.parse::<$t>().unwrap());
        }
        result
    }}
}

fn main() {
    let n = readln!(i64);
    let m = readln!(i64);
    if n > 30 {
        println!("{}",m);
    } else {
        println!("{}",m%(1<<n));
    }
}


//spnauti-rust
use std::io::*;
use std::str::*;
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::*;
#[allow(unused_imports)] use std::collections::*;

#[allow(unused_macros)]
macro_rules! a {
    ($c: tt, $x: expr, $y: expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
struct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).ok();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}

#[allow(dead_code)]
fn build_counting_hashmap<K: Eq + std::hash::Hash, T>(i: T) -> HashMap<K,usize>
    where T: Iterator<Item = K> {
    let mut m = HashMap::new();
    for k in i {
        let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };
        m.insert(k, n);
    }
    m
}

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    let mut a = input.vi(6);
    a.sort();
    let (x,y) = if a[0] == a[3] {
        (4,5)
    } else if a[1] == a[4] {
        (0,5)
    } else if a[2] == a[5] {
        (0,1)
    } else {
        println!("Alien");
        return;
    };
    if a[x] == a[y] {
        println!("Elephant");
    } else {
        println!("Bear");
    }
}


#[allow(unused_imports)]
use std::cmp::{max,min};
#[allow(unused_imports)]
use std::collections::{HashMap,HashSet,VecDeque};

#[allow(unused_macros)]
macro_rules! readln {
  () => {{
    use std::io;

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_string()
  }};
  ( $t:ty ) => {{
    let input = readln!();
    input.parse::<$t>().unwrap()
  }};
  ( $( $t:ty ),+ ) => {{
    let input = readln!();
    let mut input = input.split_whitespace();
    (
     $(
       input.next().unwrap().parse::<$t>().unwrap(),
      )+
    )
  }}
}

#[allow(unused_macros)]
macro_rules! readvec {
  ( $t:ty ) => {{
    let input = readln!();
    let mut input = input.split_whitespace();
    let mut result = Vec::new();
    for elem in input {
      result.push(elem.parse::<$t>().unwrap());
    }
    result
  }}
}

fn main() {
  let mut a =readvec!(i32);
  a.sort();
  let mut i1 = 10;
  let mut i2 = 10;
  if a[0] == a[3] {
    i1 = 4;
    i2 = 5;
  } else if a[1] == a[4] {
    i1 = 0;
    i2 = 5;
  } else if a[2] == a[5] {
    i1 = 0;
    i2 = 1;
  } else {
    println!("Alien");
    return;
  }
  if i1 >= a.len() {
    println!("Alien");
    return;
  }
  if a[i1] == a[i2] {
    println!("Elephant");
  } else {
    println!("Bear");
  }
}


use std::io;
use std::collections::HashSet;

macro_rules! parse_line {
    ($($t: ty),+) => ({
        let mut a_str = String::new();
        io::stdin().read_line(&mut a_str).expect("read error");
        let mut a_iter = a_str.split_whitespace();
        (
            $(
            a_iter.next().unwrap().parse::<$t>().expect("parse error"),
            )+
        )
    })
}

fn bruteforce(n: u64) -> u64 {
    let mut set = HashSet::<u64>::new();

    for a in 0..=n {
        for b in 0..=(n - a) {
            for c in 0..=(n - a - b) {
                set.insert(4 * a + 9 * b + 49 * c);
            }
        }
    }

    set.len() as u64
}

fn main() {
    let (n,) = parse_line!(u64);

    let answer = if n < 11 {
        bruteforce(n)
    } else {
        // The items {0, 4, 8, 9, 12, 13, 16, 17, 18, 20, 21, 22} are always reachable.
        let mut answer = 12u64;

        // The range 24 -- (67 + 49(n - 11)) = 49n - 472 is always reachable.
        answer += (49 * n - 472) - 24 + 1;

        // Now, the only numbers for which we don't know the answer are those in the range
        // [49n - 471, 49n]. For those, we brute-force the check.
        //
        // Formally, we wonder how many numbers in the range [49n - 471, 49n] can be written in the
        // form 4a + 9b + 49c with a + b + c <= n and a, b, c >= 0.
        //
        // The important observation is that if c <= n - 12, there is no way
        // 4a + 9b + 49c >= 49n - 471. Indeed, we have
        //               4a + 9b + 49c <= 9(n - c) + 49c
        //                             =  9n + 40c
        //                             <= 9n + 40(n - 12)
        //                             <= 49n - 40 * 12
        //                             <  49n - 471.
        //
        // For this reason, we know that c is in the range n - 11 .. n. This does not leave many
        // cases to check.
        let mut tailset = HashSet::<u64>::new();
        for c in (n - 11)..=n {
            for b in 0..=(n - c) {
                for a in 0..=(n - c - b) {
                    assert!(a + b + c <= n);

                    let candidate = 4 * a + 9 * b + 49 * c;
                    if candidate >= n * 49 - 471 {
                        tailset.insert(candidate);
                    }
                }
            }
        }

        answer += tailset.len() as u64;
        answer
    };

    println!("{}", answer);
}


//spnauti-rusT {{{
use std::io::*; use std::str::{self,*}; use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_imports)] use std::cell::*;
#[allow(unused_macros)] macro_rules! min {
	($x:expr,$y:expr) => {{ let b=$y; let a=&mut$x; if b < *a {*a=b; true} else {false} }};
}
#[allow(unused_macros)] macro_rules! max {
	($x:expr,$y:expr) => {{ let b=$y; let a=&mut$x; if b > *a {*a=b; true} else {false} }};
}
#[allow(unused_macros)] macro_rules! l {
	($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};
	($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};
	(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};
	(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};
}
#[allow(unused_macros)] macro_rules! v {
	([$d:expr]$($s:tt)+) => {vec![v!($($s)+);$d]};
	([]) => {Vec::new()}; ([$e:expr]) => {Vec::with_capacity($e)}; (=$e:expr) => {$e};
}
#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }
#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }
#[allow(dead_code)] fn writer() -> BufWriter<Stdout> { BufWriter::new(stdout()) }
struct WordReaderC {buf: Vec<u8>, pos: usize, q: std::io::StdinLock<'static>}//'
#[allow(dead_code)] impl WordReaderC {
	fn new() -> Self {
		let r = unsafe {&*Box::into_raw(Box::new(stdin()))};
		Self { q: r.lock(), buf: v!([]), pos: 0 }
	}
	fn next_line(&mut self) -> bool {
		self.buf.clear(); self.pos = 0;
		self.q.read_until(b'\n', &mut self.buf).unwrap_or(0) > 0
	}
	fn is_ws(c: u8) -> bool {
		c == b' ' || c == b'\r' || c == b'\n' || c == b'\t'
	}
	fn byte(&mut self) -> Option<u8> {
		if self.pos == self.buf.len() { if !self.next_line() { return None; } }
		self.pos += 1; Some(self.buf[self.pos - 1])
	}
	fn vb(&mut self) -> Vec<u8> {
		let mut s = v!([8]);
		let mut f = false;
		loop {
			if let Some(c) = self.byte() {
				if !Self::is_ws(c) {
					s.push(c);
					f = true;
				} else if f { break; }
			} else { break; }
		}
		s
	}
	fn board(&mut self, r: usize, c: Option<usize>) -> Vec<Vec<u8>> {
		let mut res = v!([r]);
		let c = c.unwrap_or(0);
		rep!{[r]
			let t = self.vb();
			assert!(c == 0 || t.len() == c);
			res.push(t);
		}
		res
	}
	fn framed_board(&mut self, r: usize, c: usize, f: u8) -> Vec<Vec<u8>> {
		let mut res = v!([r+2]);
		res.push( v!([c+2] = f) );
		rep!{[r]
			let mut t = self.vb();
			assert!(t.len() == c);
			t.reserve(2);
			t.insert(0,f);
			t.push(f);
			res.push(t);
		}
		res.push( v!([c+2] = f) );
		res
	}
	fn s(&mut self) -> String { String::from_utf8(self.vb()).expect("invalid utf8") }
	fn i(&mut self) ->    i32 { self.p() }
	fn l(&mut self) ->    i64 { self.p() }
	fn u(&mut self) ->  usize { self.p() }
	fn f(&mut self) ->    f64 { self.p() }
	fn vi(&mut self, n: usize) -> Vec<i32> { self.vp(n) }
	fn vl(&mut self, n: usize) -> Vec<i64> { self.vp(n) }
	fn vu(&mut self, n: usize) -> Vec<usize> { self.vp(n) }
	fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> { self.ip(n).into_iter() }
	fn iu(&mut self, n: usize) -> impl Iterator<Item=usize> { self.ip(n).into_iter() }
	fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
		let w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::<T>().unwrap()
	}
	fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
		(0..n).map(|_|self.p()).collect()
	}
	fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
		self.vp(n).into_iter()
	}
	fn graph(&mut self, n: usize, m: usize) -> Vec<Vec<usize>> {
		let mut e = v!([n][]); rep!{[m] l!(a,b = self.u()-1); e[a].push(b); e[b].push(a); } e
	}
	fn graph_w<T: Copy+FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<(usize,T)>> where T::Err: Debug {
		let mut e = v!([n][]); rep!{[m] l!(a,b = self.u()-1); let c: T = self.p(); e[a].push((b,c)); e[b].push((a,c)); } e
	}
}
//------------------- End rusT }}}

fn main() {
	let mut rin = reader();
	let mut rout = writer();
	const A: &[usize] = &[0,4,9,49];

	let mut sol = v!([13] = 0_i64);
	let mut dp = v!([49*12+1] = false);
	dp[0] = true;
	for n in 1..=12 {
		for i in (4..=49*n).rev() {
			for &a in A {
				if i >= a && dp[i-a] {
					dp[i] = true;
					break;
				}
			}
		}
		sol[n] = dp.iter().filter(|&&x| x).count() as i64;
	}
	let n = rin.u();
	let sol = sol[n.min(12)] + 49 * (12.max(n as i64) - 12);
	writeln!(rout, "{}", sol).ok();
}


// ---------- begin chmin, chmax ----------
trait ChangeMinMax {
    fn chmin(&mut self, x: Self) -> bool;
    fn chmax(&mut self, x: Self) -> bool;
}

impl<T: PartialOrd> ChangeMinMax for T {
    fn chmin(&mut self, x: Self) -> bool {
        *self > x && {
            *self = x;
            true
        }
    }
    fn chmax(&mut self, x: Self) -> bool {
        *self < x && {
            *self = x;
            true
        }
    }
}
// ---------- end chmin, chmax ----------
// ---------- begin input macro ----------
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        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, bytes) => {
        read_value!($iter, String).bytes().collect::<Vec<u8>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// ---------- end input macro ----------

fn run() {
    input! {
        n: u64,
    }
    let mul = |a: &[(u64, u64)], b: &[(u64, u64)]| -> Vec<(u64, u64)> {
        let mut c = vec![];
        for a in a.iter() {
            for b in b.iter() {
                c.push((a.0 + b.0, a.1 + b.1 - 1));
            }
        }
        c.sort_unstable();
        c.dedup_by(|a, b| {
            a.0 <= b.1 && {
                b.1.chmax(a.1);
                true
            }
        });
        c
    };
    let mut t = vec![(0, 1)];
    let mut s = vec![(1, 2), (5, 6), (10, 11), (50, 51)];
    let mut n = n;
    while n > 0 {
        if n & 1 == 1 {
            t = mul(&t, &s);
        }
        s = mul(&s, &s);
        n >>= 1;
    }
    let ans = t.iter().fold(0, |s, a| s + a.1 - a.0);
    println!("{}", ans);
}

fn main() {
    run();
}


fn read_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).expect(
        "Could not read line",
    );
    String::from(&line[..line.len() - 1])
}

macro_rules! read_line {
    (Vec<$t: ty>) => {{
        read_line().split_whitespace().map(|token| {
            <$t as std::str::FromStr>::from_str(token).expect(
                &format!(concat!("Could not parse {} into ", stringify!($t)), token))
        }).collect::<Vec<$t>>()
    }};
    ($($t: ty),*) => {{
        let line = read_line();
        let mut iter = line.split_whitespace();
        let result = ($({
            let token = iter.next().expect("Not enough tokens");
            <$t as std::str::FromStr>::from_str(token).expect(
                &format!(concat!("Could not parse {} into ", stringify!($t)), token))
        }),*);
        if let Some(token) = iter.next() {
            panic!("Unexpected token {}", token);
        }
        result
    }};
}

fn main() {
    let (s, f) = read_line!(String, String);
    let s = s.chars().nth(0).unwrap();
    let f = f.chars().nth(0).unwrap();
    let time = read_line!(usize);
    let all = ['v', '<', '^', '>'];
    let s = all.iter().enumerate().find(|x| *x.1 == s).unwrap().0;
    let f = all.iter().enumerate().find(|x| *x.1 == f).unwrap().0;
    let canCw = (s + time) % 4 == f;
    let canCcw = s == (f + time) % 4;
    println!(
        "{}",
        match (canCw, canCcw) {
            (false, false) => panic!("impossible"),
            (true, false) => "cw",
            (false, true) => "ccw",
            (true, true) => "undefined",
        }
    );
}


fn read_string() -> String {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Failed");
    input
}

fn read_int() -> u64 {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Failed");
    let x = input.trim().parse::<u64>().unwrap();
    input.clear();
    x
}

fn main(){
    let s = read_string();
    let vec: Vec<&str> = s.split("").collect();
    let start_pos_as_char = vec[1].chars().next().unwrap() as u8;
    let end_pos_as_char = vec[3].chars().next().unwrap() as u8;
    let x = read_int();
    let cases = vec![118, 60, 94, 62]; // down left up right
    let sp = cases.iter().position(|&r| r == start_pos_as_char).unwrap();
    let ep = cases.iter().position(|&r| r == end_pos_as_char).unwrap();
    let is_even = ((x % 2) + 2) % 2;
    let result = (((x+sp as u64) % 4) + 4) % 4;
    if is_even == 0{
        println!("undefined");
    } else if (sp < 4) && (cases[result as usize] == end_pos_as_char) || (cases[result as usize] == end_pos_as_char) && (ep == 4){
        println!("cw");
    } else {
        println!("ccw");
    }

}


#[macro_export]
macro_rules! scanln {
  ($($var:ident : $ty:path),+) => {
    $(let $var: $ty;)+
    {
      use std::io;
      let mut __buf = String::new();
      io::stdin().read_line(&mut __buf).unwrap();
      let mut eles = __buf.split_whitespace();
      $($var = Scan::scan(&mut eles);)+
    }
  }
}

pub trait Scan {
  fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str>;
}

macro_rules! impl_scan_single {
  ($ty:ty) => {
    impl Scan for $ty {
      fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str> {
        let next = eles.next().unwrap();
        match next.parse() {
          Ok(res) => res,
          Err(_) => panic!()
        }
      }
    }
  }
}

impl_scan_single!(u8);
impl_scan_single!(u16);
impl_scan_single!(u32);
impl_scan_single!(u64);
impl_scan_single!(usize);
impl_scan_single!(i8);
impl_scan_single!(i16);
impl_scan_single!(i32);
impl_scan_single!(i64);
impl_scan_single!(isize);
impl_scan_single!(f32);
impl_scan_single!(f64);
impl_scan_single!(String);

const __IMPL_SCAN_FOR_VEC: () = {
  use std::str::FromStr;
  impl<T> Scan for Vec<T> where T: FromStr {
    fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str> {
      eles.map(|str| match str.parse() {
        Ok(res) => res,
        Err(_) => panic!()
      }).collect()
    }
  }
};

// -----------------------------------------------------------------------------

fn modu(x: i32, y: i32) -> i32 {
  let res = x % y;
  if res < 0 { res + y } else { res }
}

fn main() {
  scanln!(start: String, end: String);
  scanln!(rotations: i32);
  let start = match &start as &str {
    "^" => 0i32,
    ">" => 1i32,
    "v" => 2i32,
    "<" => 3i32,
    _ => unreachable!()
  };
  let end = match &end as &str {
    "^" => 0i32,
    ">" => 1i32,
    "v" => 2i32,
    "<" => 3i32,
    _ => unreachable!()
  };
  let cw = modu(start + (rotations % 4), 4);
  let ccw = modu(start - (rotations % 4), 4);
  if cw == end && ccw == end {
    println!("undefined");
  } else if cw == end {
    println!("cw");
  } else if ccw == end {
    println!("ccw");
  } else {
    println!("undefined");
  }
}


fn dir(c: char) -> i32 {
    match c {
        'v' => 0,
        '<' => 1,
        '^' => 2,
        '>' => 3,
        _ => panic!("Invalid character"),
    }
}

fn modu(a: i32) -> i32 {
    if a < 0 {
        a % 4 + 4
    } else {
        a % 4
    }
}

fn main() {
    let mut input = String::new();

    std::io::stdin().read_line(&mut input).unwrap();

    let mut iter = input.chars();

    let start = iter.next().unwrap();
    iter.next().unwrap();
    let end = iter.next().unwrap();

    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();

    let mut it = input.split_whitespace().map(|x| x.parse::<i32>().unwrap());

    let n = it.next().unwrap();

    if n % 2 == 0 {
        println!("undefined");
    } else if n % 4 == modu(dir(end) - dir(start)) {
        println!("cw");
    } else {
        println!("ccw");
    }
}


fn read_line() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).expect("EOF");
    line.pop();
    return line;
}

macro_rules! read_line {
    (Vec<$t: ty>) => {{
        read_line().split_whitespace().map(|token| {
            <$t as std::str::FromStr>::from_str(token).expect("Invalid token")
        }).collect<Vec<$t>>()
    }};
    ($($t: ty),*) => {{
        let line = read_line();
        let mut iter = line.split_whitespace();
        ($({
            let token = iter.next().expect("Too few tokens");
            <$t as std::str::FromStr>::from_str(token).expect("Invalid token")
        }), *)
    }};
}

fn spinner_position(c: char) -> i32 {
    match c {
        '^' => 0,
        '>' => 1,
        'v' => 2,
        '<' => 3,
        _ => -1,
    }
}

fn main() {
    let (s, t) = read_line!(String, String);
    let n = read_line!(i32) % 4;
    let x = spinner_position(s.chars().nth(0).expect(""));
    let y = spinner_position(t.chars().nth(0).expect(""));
    let d = (y - x + 4) % 4;
    if n % 2 == 0 {
        println!("undefined");
    } else if d == n {
        println!("cw");
    } else if d == 4 - n {
        println!("ccw");
    }
}


use std::io;

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).expect("failed to read input");
    let s: u32 = buffer.trim().parse().expect("invalid input");

    println!("{}", 2 * (s / 3) + if s % 3 != 0 { 1 } else { 0 });
}


//! https://codeforces.com/problemset/problem/630/I
//! To quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.
//! The parking lot before the office consists of one line of (2n - 2) parking spaces. Unfortunately the total number of cars is greater than the parking lot capacity. Furthermore even amount of cars of each make is greater than the amount of parking spaces! That's why there are no free spaces on the parking lot ever.
//! Looking on the straight line of cars the company CEO thought that parking lot would be more beautiful if it contained exactly n successive cars of the same make. Help the CEO determine the number of ways to fill the parking lot this way.
use std::io;

fn main() {
    let mut inp = String::new();
    io::stdin().read_line(&mut inp).unwrap();
    let inp: u64 = inp.trim().parse().unwrap();

    let ans: u64 = (9*inp - 3) * binexp(4, inp - 3);
    println!("{}", ans);
}

fn binexp(mut x: u64, mut y: u64) -> u64 {
    let mut res = 1;
    while y != 0 {
        if y & 1 == 1 {
            res *= x;
        }
        x*=x;
        y>>=1;
    }
    res
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let mut n: i64 = get();
    let k: i32 = get();
    let mut cnt = 0;
    let mut kk = k;
    while kk > 0 {
        if n == 0 {
            cnt = max(cnt + k - kk - 1, 0);
            break;
        }
        if n % 10 != 0 {
            cnt += 1;
        } else {
            kk -= 1;
        }
        n /= 10;
    }
    println!("{}", cnt);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


use std::io::{ self, BufRead };

macro_rules! scan_to_vec {
    ($count:expr, $t:ty) => ({
        let mut result = Vec::new();
        let stdin = io::stdin();
        let mut handle = stdin.lock();

        for _ in 0..$count {
            let mut buffer = String::new();
            handle.read_line(&mut buffer)
                .expect("scan_to_vec: failed at `handle.read_line`.");
            result.push(buffer.trim().parse::<$t>()
                .expect("scan_to_vec: failed at `parse::<$t>`."));
        }
        result
    })
}

macro_rules! scan_line_to_vec {
    ($t:ty) => ({
        let mut result = Vec::new();
        let stdin = io::stdin();
        let mut handle = stdin.lock();
        handle.read_line(&mut buffer)
            .expect("scan_line_to_vec: failed at `handle.read_line`.");

        for s in chunks.split_whitespace() {
            result.push(s.parse::<$t>()
                .expect("scan_line_to_vec: failed at `parse::<$t>`."));
        }
        result
    })
}

macro_rules! scan_line {
    ( $($t:ty)+ ) => ({
        let stdin = io::stdin();
        let mut handle = stdin.lock();
        let mut buffer = String::new();
        handle.read_line(&mut buffer)
            .expect("scan_line: failed at `handle.read_line`.");
        let mut chunks = buffer.split_whitespace();

        ($(
            {
                chunks.next()
                    .expect("scan_line: failed at `next`, # of space separated strings not equal to requested #")
                .parse::<$t>()
                    .expect("scan_line: failed at `parse::<$t>`.")
            },
        )+)
    })
}

fn main() {
    let (n, k) = scan_line!(String usize);
    let mut v = n.into_bytes().iter().map(|x| x - b'0').collect::<Vec<u8>>();
    let zero_count = v.iter().filter(|x| x == &&0).count();

    let mut result = 0;
    while v.len() > 0 {
        let zeroes = v.iter().rev().take_while(|x| **x == 0).count();
        if zeroes as usize >= k { break; }
        let first_nonzero = v.iter().rposition(|&x| x != 0);
        if first_nonzero.is_some() {
            v.remove(first_nonzero.unwrap());
        } else {
            v.pop();
        }
        result += 1;
    }

    if v.len() == 0 && zero_count > 0 {
        result -= 1;
    }

    println!("{}", result);
}


fn main () {
    use std::io;
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("");
    let a: Vec<i32> = input.trim().split(' ').map(|x| x.parse::<i32>().unwrap()).collect();
    if a[0] < 10i32.pow(a[1] as u32) {
        println!("{}", a[0].to_string().len() - 1);
    }
    else if a[0] == 10i32.pow(a[1] as u32) {
        println!("0");
    }
    else {
        let mut t = a[0];
        let mut zeros = 0;
        let mut removed = 0;
        while zeros < a[1] {
            if t % 10 == 0 {
                zeros += 1;
            }
            else {
                removed += 1;
            }
            t = t / 10;
            // println!("{} {}", t, zeros);
        }
        if t == 0 {
            println!("{}", a[0].to_string().len() - 1);
        }
        else {
            println!("{}", removed);
        }
    }
}


use std::io;
use std::str::FromStr;

use std::io::prelude::*;
use std::io::BufReader;
use std::cmp::{max, min};

fn get_line() -> String {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input
}

fn get_vec<T>() -> Vec<T>
where T: FromStr,
      <T as FromStr>::Err: std::fmt::Debug,
{
    get_line().split_whitespace().map(|k| k.parse().unwrap()).collect()
}

fn main() {
    let (n, k): (String, usize) = {
        let input = get_line();
        let mut it = input.split_whitespace();
        (
            it.next().unwrap().to_string(),
            it.next().unwrap().parse().unwrap(),
            )
    };

    let ans = if let Some((i, _)) = n.bytes().rev().enumerate().filter(|&(i, b)| b == b'0').nth(k - 1) {
        i + 1 - k
    } else {
        n.len() - 1
    };

    println!("{}", ans);
}


#![allow(unused_imports)]
#![allow(dead_code)]
use std::cmp::*;
use std::collections::*;

fn main() {
    let (n, k): (usize, usize) = readln();
    let n: Vec<char> = n.to_string().chars().collect();
    let res0 = n.len() - 1;
    let mut res1 = 0;
    let mut acc = 0;
    for i in (0..n.len()).rev() {
        if acc == k {
            break;
        }
        if n[i] == '0' {
            acc += 1;
        } else {
            res1 += 1;
        }
    }

    println!("{}", if acc == k { min(res0, res1) } else { res0 });
}

fn get_line() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_string()
}

fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}

fn readln<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

trait Read {
    fn read(s: &str) -> Self;
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}


//spnauti-rust
use std::io::*;
use std::str::*;
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::*;
#[allow(unused_imports)] use std::collections::*;

#[allow(unused_macros)]
macro_rules! a {
    ($c: tt, $x: expr, $y: expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
struct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).ok();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}

#[allow(dead_code)]
fn build_counting_hashmap<K: Eq + std::hash::Hash, T>(i: T) -> HashMap<K,usize>
    where T: Iterator<Item = K> {
    let mut m = HashMap::new();
    for k in i {
        let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };
        m.insert(k, n);
    }
    m
}

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    let a = input.i();
    let b = input.i();
    let c = input.i();
    let d = b - a;
    if d == 0 || (c != 0 && d % c == 0 && d / c > 0) {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;
use std::cmp;

fn solution(input: String) {
    let max_fits = input.trim().len() / 11;
    let possible_fits = input.chars().filter_map(|x| {
        if x == '8' {
            Some(1)
        } else {
            None
        }
    }).sum();
    println!("{:?}", cmp::min(possible_fits, max_fits));
}

pub fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input);
    input.clear();
    match io::stdin().read_line(&mut input) {
        Ok(n) => {
            solution(input)
        }
        Err(error) => println!("error: {}", error),
    }
}


use std::io::{self, Read};
use std::cmp;

fn main() {
    let mut buffer = String::new();
    let stdin = io::stdin();
    let mut handle = stdin.lock();
    handle.read_to_string(&mut buffer).unwrap();

    let arr : Vec<&str> = buffer.split_whitespace().collect();
    let mut num_8 = 0;
    let mut tot = 0;
    for i in arr[1].chars() {
        let d = i as u8 - '0' as u8;
        if d == 8 {
            num_8 += 1;
        }
        tot += 1;
    }

    let mut ans = 0;
    for i in 1..num_8+1 {
        let m = (tot-i)/10;
        use std::cmp;
        let h = cmp::min(m,i);
        ans = cmp::max(h,ans);
    }

    println!("{}",ans);
}


fn main() {
    let mut n_str = String::new();
    let mut numbers_str = String::new();
    std::io::stdin().read_line(&mut n_str);
    std::io::stdin().read_line(&mut numbers_str);

    let numbers_str = numbers_str.trim();

    let n: i32 = n_str.trim().parse().unwrap();

    let mut result = n / 11;

    let mut has_8_count = 0;

    for (_, c) in numbers_str.chars().enumerate(){
        if c == '8'{
            has_8_count += 1;
        }
    }

    if has_8_count < result {
        result = has_8_count;
    }

    println!("{}", result);

}


#![allow(dead_code, unused_macros, unused_imports)]
use std::{cell::{Cell, RefCell, UnsafeCell}, cmp::{Ordering, Reverse, max, min}, collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque, hash_map::{DefaultHasher, RandomState}}, error::Error, fmt::{Display, Write as FmtWrite}, hash::{BuildHasher, Hash, Hasher}, io::{BufWriter, Read, Stdin, Stdout, Write}, iter::{FromIterator, Peekable}, mem::swap, ops::*, process::exit, rc::Rc, str::{FromStr, from_utf8_unchecked}, time::{Duration, Instant}, convert::{TryInto, TryFrom}, marker::PhantomData};

const IO_BUF_SIZE: usize = 1 << 16;
type Input = Scanner<Stdin>;
type Output = BufWriter<Stdout>;
fn _init_input() -> Input { Scanner::new(std::io::stdin()) }
fn _init_output() -> Output { BufWriter::with_capacity(IO_BUF_SIZE, std::io::stdout()) }

#[repr(transparent)] struct Unsync<T>(T);
unsafe impl<T> Sync for Unsync<T> {}

type BadLazy<T> = Unsync<UnsafeCell<Option<T>>>;
impl<T> BadLazy<T> {
    const fn new() -> Self { Self(UnsafeCell::new(None)) }
}

static INPUT: BadLazy<Input> = BadLazy::new();
static OUTPUT: BadLazy<Output> = BadLazy::new();

fn inp<F: FnOnce(&mut Input) -> R, R>(f: F) -> R {
    unsafe { f((&mut *INPUT.0.get()).get_or_insert_with(_init_input)) }
}
fn out<F: FnOnce(&mut Output) -> R, R>(f: F) -> R {
    unsafe { f((&mut *OUTPUT.0.get()).get_or_insert_with(_init_output)) }
}

macro_rules! read {
    () => { read() };
    ($t: ty) => { read::<$t>() };
    ($t: ty, $($tt: ty),*) => { (read::<$t>(), $(read::<$tt>(),)*) };
    [$t: ty; $n: expr] => { read_vec::<$t>($n) };
}
macro_rules! println {
    () => { out(|x| { let _ = writeln!(x); }) };
    ($exp: expr) => { out(|x| { let _ = writeln!(x, "{}", $exp); }) };
    ($fmt: expr, $($arg : tt )*) => { out(|x| { let _ = writeln!(x, $fmt, $($arg)*); }) }
}
macro_rules! print {
    ($exp: expr) => { out(|x| { let _ = write!(x, "{}", $exp); }) };
    ($fmt: expr, $($arg : tt )*) => { out(|x| { let _ = write!(x, $fmt, $($arg)*); }) }
}

fn out_flush() { out(|x| { let _ = x.flush(); }); }

fn input_is_eof() -> bool { inp(|x| x.eof()) }
fn read_byte() -> u8 { inp(|x| x.byte()) }
fn read_bytes_no_skip(n: usize) -> Vec<u8> { inp(|x| x.bytes_no_skip(n)) }
fn read_bytes(n: usize) -> Vec<u8> { inp(|x| x.bytes(n)) }
fn read_bytes2(n: usize, m: usize) -> Vec<Vec<u8>> { inp(|x| x.bytes2(n, m)) }
fn read_token() -> Vec<u8> { inp(|x| x.token_bytes()) }
fn read_token_str() -> String { unsafe { String::from_utf8_unchecked(read_token()) } }
fn read_line() -> Vec<u8> { inp(|x| x.line_bytes()) }
fn read_line_str() -> String { unsafe { String::from_utf8_unchecked(read_line()) } }
fn read<T: FromStr>() -> T { read_token_str().parse::<T>().ok().expect("failed parse") }
fn read_vec<T: FromStr>(n: usize) -> Vec<T> { (0..n).map(|_| read()).collect() }
fn read_vec2<T: FromStr>(n: usize, m: usize) -> Vec<Vec<T>> { (0..n).map(|_| read_vec(m)).collect() }

struct Scanner<R: Read> {
    src: R,
    _buf: Vec<u8>,
    _pt: usize, // pointer
    _rd: usize, // bytes read
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(src: R) -> Scanner<R> {
        Scanner { src, _buf: vec![0; IO_BUF_SIZE], _pt: 1, _rd: 1 }
    }

    fn _check_buf(&mut self) {
        if self._pt == self._rd {
            self._rd = self.src.read(&mut self._buf).unwrap_or(0);
            self._pt = (self._rd == 0) as usize;
        }
    }

    // returns true if end of file
    fn eof(&mut self) -> bool {
        self._check_buf();
        self._rd == 0
    }

    // filters \r, returns \0 if eof
    fn byte(&mut self) -> u8 {
        loop {
            self._check_buf();
            if self._rd == 0 { return 0; }
            let res = self._buf[self._pt];
            self._pt += 1;
            if res != b'\r' { return res; }
        }
    }

    fn bytes_no_skip(&mut self, n: usize) -> Vec<u8> { (0..n).map(|_| self.byte()).collect() }
    fn bytes(&mut self, n: usize) -> Vec<u8> {
        let res = self.bytes_no_skip(n);
        self.byte();
        res
    }
    fn bytes2(&mut self, n: usize, m: usize) -> Vec<Vec<u8>> { (0..n).map(|_| self.bytes(m)).collect() }

    fn token_bytes(&mut self) -> Vec<u8> {
        let mut res = Vec::new();
        let mut c = self.byte();
        while c <= b' ' {
            if c == b'\0' { return res; }
            c = self.byte();
        }
        loop {
            res.push(c);
            c = self.byte();
            if c <= b' ' { return res; }
        }
    }

    fn line_bytes(&mut self) -> Vec<u8> {
        let mut res = Vec::new();
        let mut c = self.byte();
        while c != b'\n' && c != b'\0' {
            res.push(c);
            c = self.byte();
        }
        res
    }
}

trait JoinToStr {
    fn join_to_str(self, sep: &str) -> String;
    fn concat_to_str(self) -> String;
}
impl<T: Display, I: Iterator<Item = T>> JoinToStr for I {
    fn join_to_str(mut self, sep: &str) -> String {
        match self.next() {
            Some(first) => {
                let mut res = first.to_string();
                while let Some(item) = self.next() {
                    res.push_str(sep);
                    res.push_str(&item.to_string());
                }
                res
            }
            None => { String::new() }
        }
    }

    fn concat_to_str(self) -> String {
        let mut res = String::new();
        for item in self { res.push_str(&item.to_string()); }
        res
    }
}
trait AsStr { fn as_str(&self) -> &str; }
impl AsStr for [u8] { fn as_str(&self) -> &str {std::str::from_utf8(self).expect("attempt to convert non-UTF8 byte string.")} }

macro_rules! veci {
    ($n:expr , $i:ident : $gen:expr) => {{
        let _veci_n = $n;
        let mut _veci_list = Vec::with_capacity(_veci_n);
        for $i in 0.._veci_n {
            _veci_list.push($gen);
        }
        _veci_list
    }};
    ($n:expr , $gen:expr) => { veci!($n, _veci_: $gen) }
}

fn abs_diff<T: Sub<Output = T> + PartialOrd>(x: T, y: T) -> T {
    if x < y { y - x } else { x - y }
}

trait CommonNumExt {
    fn div_ceil(self, b: Self) -> Self;
    fn div_floor(self, b: Self) -> Self;
    fn gcd(self, b: Self) -> Self;
    fn highest_one(self) -> Self;
    fn lowest_one(self) -> Self;
    fn sig_bits(self) -> u32;
}

macro_rules! impl_common_num_ext {
    ($($ix:tt = $ux:tt),*) => {
        $(
            impl CommonNumExt for $ux {
                fn div_ceil(self, b: Self) -> Self {
                    let q = self / b; let r = self % b;
                    if r != 0 { q + 1 } else { q }
                }
                fn div_floor(self, b: Self) -> Self { self / b }
                fn gcd(self, mut b: Self) -> Self {
                    let mut a = self;
                    if a == 0 || b == 0 { return a | b; }
                    let shift = (a | b).trailing_zeros();
                    a >>= a.trailing_zeros();
                    b >>= b.trailing_zeros();
                    while a != b {
                        if a > b { a -= b; a >>= a.trailing_zeros(); }
                        else { b -= a; b >>= b.trailing_zeros(); }
                    }
                    a << shift
                }
                #[inline] fn highest_one(self) -> Self {
                    if self == 0 { 0 } else { const ONE: $ux = 1; ONE << self.sig_bits() - 1 }
                }
                #[inline] fn lowest_one(self) -> Self { self & self.wrapping_neg() }
                #[inline] fn sig_bits(self) -> u32 { std::mem::size_of::<$ux>() as u32 * 8 - self.leading_zeros() }
            }

            impl CommonNumExt for $ix {
                fn div_ceil(self, b: Self) -> Self {
                    let q = self / b; let r = self % b;
                    if self ^ b >= 0 && r != 0 { q + 1 } else { q }
                }
                fn div_floor(self, b: Self) -> Self {
                    let q = self / b; let r = self % b;
                    if self ^ b < 0 && r != 0 { q - 1 } else { q }
                }
                fn gcd(self, b: Self) -> Self {
                    fn w_abs(x: $ix) -> $ux { (if x.is_negative() { x.wrapping_neg() } else { x }) as _ }
                    w_abs(self).gcd(w_abs(b)) as _
                }
                #[inline] fn highest_one(self) -> Self { (self as $ux).highest_one() as _ }
                #[inline] fn lowest_one(self) -> Self { self & self.wrapping_neg() }
                #[inline] fn sig_bits(self) -> u32 { std::mem::size_of::<$ix>() as u32 * 8 - self.leading_zeros() }
            }
        )*
    }
}
impl_common_num_ext!(i8 = u8, i16 = u16, i32 = u32, i64 = u64, i128 = u128, isize = usize);

trait ChMaxMin<T> {
    fn chmax(&mut self, v: T) -> bool;
    fn chmin(&mut self, v: T) -> bool;
}
impl<T: PartialOrd> ChMaxMin<T> for Option<T> {
    fn chmax(&mut self, v: T) -> bool { if self.is_none() || v > *self.as_ref().unwrap() { *self = Some(v); true } else { false } }
    fn chmin(&mut self, v: T) -> bool { if self.is_none() || v < *self.as_ref().unwrap() { *self = Some(v); true } else { false } }
}
impl<T: PartialOrd> ChMaxMin<T> for T {
    fn chmax(&mut self, v: T) -> bool { if v > *self { *self = v; true } else { false } }
    fn chmin(&mut self, v: T) -> bool { if v < *self { *self = v; true } else { false } }
}

// * end commons * //
#[macro_use]
#[allow(dead_code)]
mod modint {
    use std::{fmt::{Display, Formatter}, marker::PhantomData, mem::swap, ops::*, str::FromStr, cell::Cell};
    use crate::ModInt;

    pub trait RemEuclidU32: Copy {
        /// Calculates `self` _mod_ `modulus` losslessly.
        fn rem_euclid_u32(self, modulus: u32) -> u32;
    }

    macro_rules! impl_rem_euclid_u32_for_small_signed {
        ($($ty:tt),*) => {
            $(
                impl RemEuclidU32 for $ty {
                    #[inline]
                    fn rem_euclid_u32(self, modulus: u32) -> u32 {
                        (self as i64).rem_euclid(i64::from(modulus)) as _
                    }
                }
            )*
        }
    }

    impl_rem_euclid_u32_for_small_signed!(i8, i16, i32, i64, isize);

    impl RemEuclidU32 for i128 {
        #[inline]
        fn rem_euclid_u32(self, modulus: u32) -> u32 {
            self.rem_euclid(i128::from(modulus)) as _
        }
    }

    macro_rules! impl_rem_euclid_u32_for_small_unsigned {
        ($($ty:tt),*) => {
            $(
                impl RemEuclidU32 for $ty {
                    #[inline]
                    fn rem_euclid_u32(self, modulus: u32) -> u32 {
                        self as u32 % modulus
                    }
                }
            )*
        }
    }

    macro_rules! impl_rem_euclid_u32_for_large_unsigned {
        ($($ty:tt),*) => {
            $(
                impl RemEuclidU32 for $ty {
                    #[inline]
                    fn rem_euclid_u32(self, modulus: u32) -> u32 {
                        (self % (modulus as $ty)) as _
                    }
                }
            )*
        }
    }

    impl_rem_euclid_u32_for_small_unsigned!(u8, u16, u32);
    impl_rem_euclid_u32_for_large_unsigned!(u64, u128);

    #[cfg(target_pointer_width = "32")]
    impl_rem_euclid_u32_for_small_unsigned!(usize);

    #[cfg(target_pointer_width = "64")]
    impl_rem_euclid_u32_for_large_unsigned!(usize);
    #[inline]
    pub fn mul_mod_u32(a: u32, b: u32, m: u32) -> u32 {
        (a as u64 * b as u64 % m as u64) as u32
    }

    // for a, b < m, unspecified otherwise
    #[inline]
    fn add_mod_raw(a: u32, b: u32, m: u32) -> u32 {
        let (r, c) = a.wrapping_sub(m).overflowing_add(b);
        if c { r } else { a + b }
    }
    #[inline]
    fn sub_mod_raw(a: u32, b: u32, m: u32) -> u32 {
        let (r, c) = a.overflowing_sub(b);
        if c { r.wrapping_add(m) } else { r }
    }
    fn pow_mod_raw(a: u32, mut k: u64, m: u32) -> u32 {
        if m == 1 { return 0; }
        let mut a = a as u64;
        let m = m as u64;
        let mut r: u64 = 1;
        while k > 0 {
            if k & 1 == 1 {
                r = r * a % m;
            }
            k >>= 1;
            a = a * a % m;
        }
        r as u32
    }

    /// # Parameters
    /// * `b` `1 <= b`
    /// # Returns
    /// (x, g) s.t. g = gcd(a, b), xa = g (mod b), 0 <= x < b/g
    fn inv_gcd(a: i64, b: i64) -> (i64, i64) {
        let a = a.rem_euclid(b);
        if a == 0 { return (0, b); }
        let mut s = b;
        let mut t = a;
        let mut m0 = 0;
        let mut m1 = 1;

        while t != 0 {
            let u = s / t;
            s -= t * u;
            m0 -= m1 * u;
            swap(&mut s, &mut t);
            swap(&mut m0, &mut m1);
        }

        if m0 < 0 { m0 += b / s; }
        (m0, s)
    }

    pub trait Modulus: Copy + Eq {
        fn get_modulus() -> u32;
        fn mul(a: u32, b: u32) -> u32;
    }

    #[derive(Clone, Copy, PartialEq, Eq, Hash)]
    #[repr(transparent)]
    pub struct ModIntBase<M: Modulus> {
        val: u32,
        _phantom: PhantomData<M>
    }

    impl <M: Modulus> ModIntBase<M> {
        #[inline(always)]
        pub fn modulus() -> u32 { M::get_modulus() }
        #[inline] pub fn new<I: RemEuclidU32>(val: I) -> Self { Self::raw(val.rem_euclid_u32(Self::modulus())) }
        #[inline] pub fn raw(val: u32) -> Self { Self { val, _phantom: PhantomData } }
        pub fn inv(self) -> Self {
            let (x, gcd) = inv_gcd(self.val.into(), Self::modulus().into());
            debug_assert!(gcd == 1, "the multiplicative inverse {}^-1 mod {} does not exist", self.val, Self::modulus());
            Self::raw(x as u32)
        }
        #[inline] pub fn val(self) -> u32 { self.val }
        #[inline] pub fn pow(self, k: u64) -> Self {
            Self::raw(pow_mod_raw(self.val, k, Self::modulus()))
        }
        pub fn powi(self, k: i64) -> Self { if k < 0 { self.inv().pow(-k as _) } else { self.pow(k as _) } }
        pub fn pow_vec(self, n: usize) -> Vec<Self> {
            let mut res = vec![Self::raw(0); n+1];
            res[0] += 1;
            for i in 1..=n {
                res[i] = res[i-1] * self;
            }
            res
        }

        pub fn invs(a: &[Self]) -> Vec<Self> {
            let n = a.len();
            if n == 0 { return vec![]; }
            let mut acc = Self::new(1);
            let mut res = Vec::with_capacity(n);
            for i in 0..n {
                if a[i].val() != 0 { acc *= a[i]; }
                res.push(acc);
            }
            acc = acc.inv();
            for i in (1..n).rev() {
                res[i] = acc * res[i-1];
                if a[i].val() != 0 { acc *= a[i]; }
            }
            res[0] = acc;
            res
        }
    }

    #[inline]
    pub fn mi<I: RemEuclidU32>(val: I) -> ModInt { ModIntBase::new(val) }
    #[inline] pub fn mir(v: u32) -> ModInt { ModIntBase::raw(v) }

    impl<V: RemEuclidU32, M: Modulus> From<V> for ModIntBase<M> {
        #[inline]
        fn from(from: V) -> Self { Self::new(from) }
    }
    impl<M: Modulus> Default for ModIntBase<M> {
        fn default() -> Self { Self::raw(0) }
    }
    impl<M: Modulus> FromStr for ModIntBase<M> {
        type Err = std::convert::Infallible;
        #[inline]
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            Ok(s.parse::<i64>()
            .map(Self::new)
            .unwrap_or_else(|_| todo!("parsing as an arbitrary precision integer?")))
        }
    }
    impl<M: Modulus> Display for ModIntBase<M> {
        #[inline]
        fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
            self.val.fmt(f)
        }
    }
    impl<M: Modulus> std::fmt::Debug for ModIntBase<M> {
        #[inline]
        fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
            std::fmt::Debug::fmt(&self.val, f)
        }
    }
    impl<M: Modulus> Neg for ModIntBase<M> {
        type Output = Self;

        #[inline]
        fn neg(self) -> Self::Output {
            Self::raw(0) - self
        }
    }

    impl<V: Into<ModIntBase<M>>, M: Modulus> Add<V> for ModIntBase<M> {
        type Output = Self;
        #[inline]
        fn add(self, rhs: V) -> Self::Output {
            Self::raw(add_mod_raw(self.val, rhs.into().val, Self::modulus()))
        }
    }
    impl<V: Into<ModIntBase<M>>, M: Modulus> Sub<V> for ModIntBase<M> {
        type Output = Self;
        #[inline]
        fn sub(self, rhs: V) -> Self::Output {
            Self::raw(sub_mod_raw(self.val, rhs.into().val, Self::modulus()))
        }
    }
    impl<V: Into<ModIntBase<M>>, M: Modulus> Mul<V> for ModIntBase<M> {
        type Output = Self;
        #[inline]
        fn mul(self, rhs: V) -> Self::Output {
            Self::raw(M::mul(self.val, rhs.into().val))
        }
    }
    impl<V: Into<ModIntBase<M>>, M: Modulus> Div<V> for ModIntBase<M> {
        type Output = Self;
        #[inline]
        fn div(self, rhs: V) -> Self::Output { self * rhs.into().inv() }
    }

    impl <V: Into<ModIntBase<M>>, M: Modulus> AddAssign<V> for ModIntBase<M> {
        #[inline]
        fn add_assign(&mut self, rhs: V) { *self = *self + rhs; }
    }
    impl <V: Into<ModIntBase<M>>, M: Modulus> SubAssign<V> for ModIntBase<M> {
        #[inline]
        fn sub_assign(&mut self, rhs: V) { *self = *self - rhs; }
    }
    impl <V: Into<ModIntBase<M>>, M: Modulus> MulAssign<V> for ModIntBase<M> {
        #[inline]
        fn mul_assign(&mut self, rhs: V) { *self = *self * rhs; }
    }
    impl <V: Into<ModIntBase<M>>, M: Modulus> DivAssign<V> for ModIntBase<M> {
        #[inline]
        fn div_assign(&mut self, rhs: V) { *self = *self / rhs; }
    }

    impl <M: Modulus> std::iter::Sum for ModIntBase<M> {
        #[inline] fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
            iter.fold(Self::raw(0), Add::add)
        }
    }
    impl <M: Modulus> std::iter::Product for ModIntBase<M> {
        #[inline] fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
            iter.fold(1.into(), Mul::mul)
        }
    }
    impl<'a, M: Modulus> std::iter::Sum<&'a Self> for ModIntBase<M> {
        #[inline] fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> ModIntBase<M> {
            iter.fold(Self::raw(0), |a, &b| a + b)
        }
    }
    impl<'a, M: Modulus> std::iter::Product<&'a Self> for ModIntBase<M> {
        #[inline] fn product<I: Iterator<Item = &'a Self>>(iter: I) -> ModIntBase<M> {
            iter.fold(1.into(), |a, &b| a * b)
        }
    }

    macro_rules! const_modulus {
        ($mint: ident, $name: ident, $modulus: expr) => {
            #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
            pub enum $name {}
            impl Modulus for $name {
                #[inline(always)] fn get_modulus() -> u32 { $modulus }
                fn mul(a: u32, b: u32) -> u32 {
                    mul_mod_u32(a, b, Self::get_modulus())
                }
            }
            pub type $mint = ModIntBase<$name>;
        }
    }

    #[derive(Debug, Clone, Copy)]
    pub struct ModulusCalc {
        pub modulus: u32,
        pub inv: u64
    }

    macro_rules! dynamic_modulus {
        ($mint: ident, $name: ident, $modulus: ident) => {
            static $modulus: crate::Unsync<Cell<ModulusCalc>> = crate::Unsync(Cell::new(ModulusCalc { modulus: 0, inv: 0 }));
            #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
            pub enum $name {}
            impl Modulus for $name {
                fn get_modulus() -> u32 { $modulus.0.get().modulus }
                fn mul(a: u32, b: u32) -> u32 {
                    let ModulusCalc { modulus, inv } = $modulus.0.get();
                    let p = a as u64 * b as u64;
                    let g = ((p as u128 * inv as u128) >> 64) as u64;
                    let (r, c) = p.overflowing_sub(g * modulus as u64);
                    if c { (r as u32).wrapping_add(modulus) } else { r as u32 }
                }
            }
            impl $name {
                pub fn set_modulus(val: u32) {
                    let inv = (1u64.wrapping_neg() / val as u64).wrapping_add(1);
                    $modulus.0.set(ModulusCalc { modulus: val, inv })
                }
            }
            pub type $mint = ModIntBase<$name>;
        }
    }

    const_modulus!(ModInt998_244_353, Mod998_244_353, 998_244_353);
    const_modulus!(ModInt1_000_000_007, Mod1_000_000_007, 1_000_000_007);
    dynamic_modulus!(DynamicModInt, DynamicModulus, DYNAMIC_MODULUS);
}

use crate::modint::*;
type ModInt = ModInt998_244_353;
// type ModInt = ModInt1_000_000_007;
// const_modulus!(ModInt, DefaultModulus, 1_000_000_009);
// type ModInt = DynamicModInt;

pub struct ModFft {
    n_inv: ModInt,
    w: Vec<ModInt>
}
impl ModFft {
    pub fn primitive_root() -> ModInt { ModInt::raw(3) /* for 998244353 */}
    pub fn good_len(deg: usize) -> usize { (deg + 1).next_power_of_two() }
    pub fn prepare(arr: &[ModInt], deg: usize) -> Vec<ModInt> {
        let n = Self::good_len(deg);
        let mut res = Vec::with_capacity(n);
        res.extend_from_slice(arr);
        res.resize(n, ModInt::raw(0));
        res
    }

    pub fn new(max_deg: usize) -> Self {
        let n = Self::good_len(max_deg);
        Self {
            n_inv: ModInt::new(n).inv(),
            w: ModInt::pow_vec(Self::primitive_root().pow((ModInt::modulus() - 1) as u64 / n as u64), n-1)
        }
    }

    pub fn transform(&self, a: &mut [ModInt]) { self.transform_impl(a, false) }
    pub fn transform_inv(&self, a: &mut [ModInt]) { self.transform_impl(a, true) }

    pub fn fft(&self, a: &[ModInt]) -> Vec<ModInt> { self.fft_deg(a, a.len() - 1) }
    pub fn fft_deg(&self, a: &[ModInt], deg: usize) -> Vec<ModInt> {
        let mut a = Self::prepare(a, deg);
        self.transform(&mut a);
        a
    }
    pub fn fft_inv(&self, a: &[ModInt]) -> Vec<ModInt> {
        let mut a = Self::prepare(a, a.len() - 1);
        self.transform_inv(&mut a);
        a
    }

    pub fn max_deg(&self) -> usize { self.w.len() - 1 }

    #[inline] fn transform_impl(&self, a: &mut [ModInt], invert: bool) {
        let sz = a.len();
        if sz <= 1 { return }
        let n = self.w.len();
        debug_assert!(sz <= n && sz.is_power_of_two(), "Array size {} must be <= {} and a power of 2", sz, n);
        let sh = sz.leading_zeros() + 1;

        for i in 0..sz {
            let j = i.reverse_bits() >> sh;
            if i < j { a.swap(i, j) }
        }

        let mut len = 2usize;
        let mut ang = (n >> 1) as isize;
        if invert { ang = -ang; }
        while len <= sz {
            let h = len >> 1;
            for i in (0..sz).step_by(len) {
                let mut k = 0usize;
                for j in i..i+h {
                    let u = a[j];
                    let v = a[j+h] * self.w[k];
                    a[j] = u + v;
                    a[j+h] = u - v;
                    k = k.wrapping_add(ang as usize) & (n-1);
                }
            }
            len <<= 1;
            ang >>= 1;
        }

        if invert {
            let sz_inv = self.n_inv * (n / sz);
            for i in 0..sz { a[i] *= sz_inv; }
        }
    }

    const NAIVE_THRESHOLD: usize = 60;
    fn naive_mul(a: &[ModInt], b: &[ModInt]) -> Vec<ModInt> {
        let n = a.len();
        let m = b.len();
        let mut ans = vec![ModInt::raw(0); n + m - 1];
        for i in 0..n { for j in 0..m {
            ans[i + j] += a[i] * b[j];
        }}
        ans
    }

    pub fn mul(&self, a: &[ModInt], b: &[ModInt]) -> Vec<ModInt> {
        if a.is_empty() || b.is_empty() { return vec![]; }
        let deg = a.len() + b.len() - 2;
        debug_assert!(deg < self.w.len(), "FFT capacity {} too small for polynomial of degree {}", self.w.len(), deg);
        if min(a.len(), b.len()) <= Self::NAIVE_THRESHOLD { return Self::naive_mul(a, b); }
        let mut a = Self::prepare(a, deg);
        let mut b = Self::prepare(b, deg);
        self.transform(&mut a);
        self.transform(&mut b);
        for i in 0..a.len() { a[i] *= b[i]; }
        self.transform_inv(&mut a);
        a.truncate(deg + 1);
        a
    }

    pub fn sq(&self, a: &[ModInt]) -> Vec<ModInt> {
        if a.is_empty() { return vec![]; }
        let deg = a.len() * 2 - 2;
        debug_assert!(deg < self.w.len(), "FFT capacity {} too small for polynomial of degree {}", self.w.len(), deg);
        if a.len() <= Self::NAIVE_THRESHOLD { return Self::naive_mul(a, a); }
        let mut a = Self::prepare(a, deg);
        self.transform(&mut a);
        for i in 0..a.len() { let ai = a[i]; a[i] = ai * ai; }
        self.transform_inv(&mut a);
        a.truncate(deg + 1);
        a
    }

    pub fn pow(&self, a: &[ModInt], exp: usize) -> Vec<ModInt> {
        if a.is_empty() { return vec![]; }
        let deg = (a.len() - 1) * exp;
        debug_assert!(deg < self.w.len(), "FFT capacity {} too small for polynomial of degree {}", self.w.len(), deg);
        let mut a = Self::prepare(a, deg);
        self.transform(&mut a);
        for i in 0..a.len() { a[i] = a[i].pow(exp as u64) }
        self.transform_inv(&mut a);
        a.truncate(deg + 1);
        a
    }

    pub fn product(&self, mut polys: VecDeque<Vec<ModInt>>) -> Vec<ModInt> {
        while let Some(p) = polys.pop_front() {
            if let Some(q) = polys.pop_front() {
                polys.push_back(self.mul(&p, &q));
            } else { return p; }
        }

        vec![ModInt::new(1)]
    }
}

#[allow(non_snake_case, non_upper_case_globals)]
fn main() {
    let num_cases: usize = 1;//read();

    for _case_num in 1..=num_cases {
        let n = read!(usize);
		let k = read!(usize);
		let f = read!(usize);

		let ff = ModFft::new(2*k);
		let mut dp = vec![mi(1); k+1];
		for _ in 1..n {
			let sq = ff.sq(&dp);
			let mut sm = sq[k+1..].iter().sum::<ModInt>();
			for i in (0..=k).rev() {
				dp[i] = sq[i] * (k + 1 - i) + sm;
				sm += sq[i];
			}
		}

		dp.resize(f+1, mi(0));
		let ans = (0..=f).map(|i| dp[i] * dp[f-i]).sum::<ModInt>();
		println!(ans);
    }

    out_flush();
}