#[allow(unused_imports)]
use std::cmp::{min,max};
use std::io::{BufWriter, stdin, stdout, Write};

#[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();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

	let k = scan.next::<usize>();
	let l = scan.next::<usize>();
	let m = scan.next::<usize>();
	let n = scan.next::<usize>();
	let d = scan.next::<usize>();

    let res = (1..=d).filter(|x| x % k == 0 || x % l == 0 || x % m == 0 || x % n == 0).count();
    writeln!(out, "{}", res).expect("fail");
}


use std::io::BufRead;

fn read_problem<R: BufRead>(br: R) -> Vec<usize> {
    let mut lines = br.lines();

    let node_ct: usize = str::parse(&lines.next().unwrap().unwrap()).unwrap();
    let mut nodes = Vec::<usize>::with_capacity(node_ct);
    nodes.extend(lines.next().unwrap().unwrap().split_whitespace()
                 .map(str::parse::<usize>)
                 .map(|n| n.unwrap()-1));
    assert!(nodes.len() == node_ct);
    assert!(lines.next().is_none());
    nodes
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    if a == 0 || b == 0 {
        return a | b;
    }
    let shift = (a|b).trailing_zeros();
    a >>= a.trailing_zeros();
    while b != 0 {
        b >>= b.trailing_zeros();
        if a > b {
            std::mem::swap(&mut a, &mut b);
        }
        b -= a;
    }
    return a << shift;
}

fn solve(nodes: Vec<usize>) -> u64 {
    let mut state = nodes.iter().map(|_| false).collect::<Vec<_>>();
    let mut solution = 1u64;

    // state is (cycle#,index); cycle# starts at 1; 0 is uninitialized
    for start in 0..state.len() {
        if state[start] {
            continue;
        }
        let mut index = start;
        let mut len = 0u64;
        while !state[index] {
            state[index] = true;
            index = nodes[index];
            len += 1;
        }
        if index != start {
            return 0;
        }
        if len&1 == 0 {
            len >>= 1;
        }
        solution = solution/gcd(solution,len) * len;
    }

    solution
}

fn main() {
    let stdin = std::io::stdin();
    let nodes = read_problem(stdin.lock());
    let sol = solve(nodes);
    if sol == 0 {
        println!("-1");
    } else {
        println!("{}", sol);
    }
}


#[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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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;
type I = usize;

fn main() {
    input!{
      n: usize,
      s: chars,
    }

    let mut cur = 0i64;
    for i in 0..n {
        if s[i] == '+' {
            cur += 1;
        } else {
            cur = max(cur-1, 0);
        }
    }
    println!("{}", cur);
}


use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
#[allow(unused_imports)]
use std::cmp;

struct Scanner<'a> {
    cin : StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin : StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main(){
	let cin = stdin();
	let cin = cin.lock();
	let mut sc = Scanner::new(cin);
	let _ : usize = sc.read();
        let s : String = sc.read();
        let mut ans : usize = 0;
        for i in s.chars() {
            match i {
                '+' => ans += 1,
                '-' => if ans != 0 { ans -= 1; },
                _ => (),
            }
        }
        println!("{}", ans);

}


#[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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      mut s: chars,
    }
    s.reverse();

    let mut ans = 0;
    let mut ones = 0;
    for i in 0..s.len() {
        if s[i] == '1' {
            ones += 1;
        }
    }
    let mut ans = (s.len() + 1) / 2;
    if s.len()%2 == 1 {
        if ones <= 1 {
            ans -= 1;
        }
    }
    puts!("{}\n", ans);
}


use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;

fn exec() {
    let mut sc = Scanner::new();
    let a: u64 = sc.ne();
    let b: u64 = sc.ne();
    let mut cnt = 0;
    for i in 0..64 {
        let k = (1 << i) - 1;
        for j in 0..i - 1 {
            let aim = k ^ (1 << j);
            // println!("{:b}", aim);
            if a <= aim && aim <= b {
                cnt += 1;
            }
        }
    }
    println!("{}", cnt);
}

fn main() {
    const STACK: usize = 16 * 1024 * 1024;
    let _ = std::thread::Builder::new()
        .stack_size(STACK)
        .spawn(|| { exec(); })
        .unwrap()
        .join()
        .unwrap();
}

#[allow(dead_code)]
struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => {
                panic!("parse error, {:?}",
                       String::from_utf8(self.buf[l..r].to_owned()))
            }
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}


fn input_sum() -> f32 {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|elem| elem.parse::<f32>().unwrap())
        .sum()
}

fn main() {
    print!(
        "{}",
        if (input_sum() / 5f32).ceil() + (input_sum() / 10f32).ceil() <= input_sum() {
            "YES"
        } else {
            "NO"
        }
    )
}


fn main() {
    let mut input = String::new();
    use std::io;
    use std::io::prelude::*;
    io::stdin().read_to_string(&mut input).unwrap();

    let n: u64 = input.trim().parse().unwrap();

    let bc = n.next_power_of_two().trailing_zeros();

    let mut cb = 1;
    let mut ans = 0;
    for _ in 0..bc {
        let t = cb * ((n - 1 + cb) / (cb << 1));
        ans += t;
        cb <<= 1;
    }

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


use std::io;

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

    io::stdin().read_line(&mut kbd).expect("WHY!");

    let kbd:u64 = kbd.trim().parse().expect("WHY!");

    if kbd > 0 {
        println!("25");
    }
}


#[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 (a,b,s) = readln!(i32,i32,i32);
    println!("{}", if s >= a.abs()+b.abs() && ((s-(a.abs()+b.abs()))%2) == 0 { "Yes" } else { "No" });
}


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

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buffer: vec![],
        }
    }

    pub fn token<T: 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();
            self.reader.read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn is_prime(n: i64) -> bool {
    let mut d = 2;
    while d * d <= n {
        if n % d == 0 {
            return false;
        }
        d += 1;
    }
    true
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let t: u32 = scan.token();
    for _ in 0..t {
        let a: i64 = scan.token();
        let b: i64 = scan.token();
        if a - b == 1 && is_prime(a + b) {
            writeln!(out, "YES").ok();
        } else {
            writeln!(out, "NO").ok();
        }
    }
}

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);
}


#![allow(unused_imports)]
#![allow(unused_macros)]
use std::io::{StdinLock, stdin, BufRead};
use std::collections::*;
use std::cmp::*;

fn scan_helper(lock : &mut StdinLock) -> String {
    let mut buffer = String::new();
    lock.read_line(&mut buffer).ok();
    buffer
}

macro_rules! scan {
    ($lock:ident, $t:ty) => ({
        scan_helper(&mut $lock).split_whitespace()
            .next().unwrap()
            .parse::<$t>().unwrap()
    });
    ($lock:ident, $($t:ty),+) => ({
        let buffer = scan_helper(&mut $lock);
        let mut iter = buffer.split_whitespace();
        ($(
            {
                iter.next().unwrap()
                    .parse::<$t>().unwrap()
            },
        )+)
    })
}

macro_rules! scan_iter {
    ($lock:ident, $t:ty) => ({
        scan_helper(&mut $lock).split_whitespace()
            .map(|x| x.parse::<$t>().unwrap())
            .collect()
    })
}

trait Ext {
    fn idx(&self) -> usize;
    fn num(&self) -> i64;
}

macro_rules! ext {
    ($t:ty) => (
        impl Ext for $t {
            #[inline]
            fn idx(&self) -> usize {
                *self as usize
            }

            #[inline]
            fn num(&self) -> i64 {
                *self as i64
            }
        }
    )
}
ext!(i64);
ext!(usize);

fn main() {
    let stdin = stdin();
    let mut s = stdin.lock();
    let (m, s) = scan!(s, usize, i64);
    let mut smallest = vec![0; m];
    let mut largest = vec![0; m];
    let lower_bound = if m == 1 { 0 } else { 1 };
    let upper_bound = (9*m).num();

    if s >= lower_bound && s <= upper_bound {
        let mut temp = s;
        for i in 0..m {
            if temp > 9 {
                largest[i] = 9;
                temp -= 9;
            } else {
                largest[i] = temp;
                break;
            }
        }

        temp = s;
        for i in (0..m).rev() {
            if temp > 9 {
                smallest[i] = 9;
                temp -= 9;
            } else {
                smallest[i] = temp - 1;
                smallest[0] += 1;
                break;
            }
        }

        let mut flag = false;
        for i in 0..m {
            if smallest[i] != 0 || flag {
                flag = true;
                print!("{}", smallest[i]);
            }
        }
        if !flag {
            print!("0");
        }
        print!(" ");

        flag = false;
        for i in 0..m {
            if largest[i] != 0 || flag {
                flag = true;
                print!("{}", largest[i]);
            }
        }
        if !flag {
            print!("0");
        }
    } else {
        println!("-1 -1");
    }
}


use std::collections::HashMap;

fn main() {
   let mut s = String::new();
   std::io::stdin().read_line(&mut s).unwrap();
   let n : i64 = s.trim().parse().unwrap();
   s = String::new();
   std::io::stdin().read_line(&mut s).unwrap();
   let m : i64 = s.trim().parse().unwrap();
   let mut count = 0;
   let mut a = n;
   let mut ispower = true;
   let mut log = 0;
   let mut dp = HashMap::new();
   dp.insert(1,0);
   loop {
        if (m%a!=0) {
            ispower = false;
            break;
        }

        count+=1;
        if (m/a<a) {
            if (dp.contains_key(&(m/a))) {
                log=count+dp[&(m/a)];
            } else {
                ispower = false;
            }
            break;
        }

        dp.insert(a,count);
        a*=n;
   }
   if ispower {
            println!("YES\n{}",log-1);
   } else {
            println!("NO");
    }
 }


fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("input: read line failed");

    let vec = input.trim().split_whitespace().map(|item| {
        item.parse::<i32>().unwrap()
    }).collect::<Vec<i32>>();

    if vec[0] > vec[1] + vec[2] {
        println!("+");
    } else if vec[0] + vec[2] < vec[1] {
        println!("-");
    } else if vec[0] == vec[1] && vec[2] == 0 {
        println!("0");
    } else {
        println!("?");
    }
}


fn main() {
    #![allow(unused_imports, unused_macros)]
    prepare_io!(_in_buf, scanner, _out);
    macro_rules ! print { ($ ($ arg : tt) *) => (:: std :: write ! (_out , $ ($ arg) *) . expect ("io error")) }
    macro_rules ! println { ($ ($ arg : tt) *) => (:: std :: writeln ! (_out , $ ($ arg) *) . expect ("io error")) }
    scan!(scanner, n);
    let pt = PrimeTable::new(n as _);
    let mut ans = M::zero();
    let mut acc = M::zero();
    for i in 1..=n {
        let c = pt.count_divisors(i as _);
        ans = acc + M::from(c);
        acc += ans;
    }
    println!("{}", ans);
}
pub type M = mint_basic::MInt998244353;
#[macro_export]
macro_rules! prepare_io {
    ($ in_buf : ident , $ scanner : ident , $ out : ident) => {
        use std::io::{stdout, BufWriter, Write as _};
        let $in_buf = read_stdin_all_unchecked();
        let mut $scanner = Scanner::new(&$in_buf);
        let $out = stdout();
        let mut $out = BufWriter::new($out.lock());
    };
}
pub fn echo<T: std::fmt::Display>(
    mut writer: impl std::io::Write,
    iter: impl IntoIterator<Item = T>,
    sep: impl std::fmt::Display,
) -> std::io::Result<()> {
    let mut iter = iter.into_iter();
    if let Some(item) = iter.next() {
        write!(writer, "{}", item)?;
    }
    for item in iter {
        write!(writer, "{}{}", sep, item)?;
    }
    writeln!(writer)
}
pub fn read_stdin_all_unchecked() -> String {
    use std::io::Read as _;
    let mut buf = Vec::new();
    std::io::stdin().read_to_end(&mut buf).expect("io error");
    unsafe { String::from_utf8_unchecked(buf) }
}
pub fn read_stdin_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).expect("io error");
    s
}
pub use scanner_impls::{IterScan, MarkedIterScan, Scanner};
mod scanner_impls {
    pub trait IterScan: Sized {
        type Output;
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output>;
    }
    pub trait MarkedIterScan: Sized {
        type Output;
        fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output>;
    }
    #[derive(Clone, Debug)]
    pub struct Scanner<'a> {
        iter: std::str::SplitAsciiWhitespace<'a>,
    }
    impl<'a> Scanner<'a> {
        #[inline]
        pub fn new(s: &'a str) -> Self {
            let iter = s.split_ascii_whitespace();
            Self { iter }
        }
        #[inline]
        pub fn scan<T>(&mut self) -> <T as IterScan>::Output
        where
            T: IterScan,
        {
            <T as IterScan>::scan(&mut self.iter).expect("scan error")
        }
        #[inline]
        pub fn mscan<T>(&mut self, marker: T) -> <T as MarkedIterScan>::Output
        where
            T: MarkedIterScan,
        {
            marker.mscan(&mut self.iter).expect("scan error")
        }
        #[inline]
        pub fn scan_vec<T>(&mut self, size: usize) -> Vec<<T as IterScan>::Output>
        where
            T: IterScan,
        {
            (0..size)
                .map(|_| <T as IterScan>::scan(&mut self.iter).expect("scan error"))
                .collect()
        }
        #[inline]
        pub fn iter<'b, T>(&'b mut self) -> ScannerIter<'a, 'b, T>
        where
            T: IterScan,
        {
            ScannerIter {
                inner: self,
                _marker: std::marker::PhantomData,
            }
        }
    }
    macro_rules ! iter_scan_impls { ($ ($ t : ty) *) => { $ (impl IterScan for $ t { type Output = Self ; # [inline] fn scan <'a , I : Iterator < Item = &'a str >> (iter : & mut I) -> Option < Self > { iter . next () ?. parse ::<$ t > () . ok () } }) * } ; }
    iter_scan_impls ! (char u8 u16 u32 u64 usize i8 i16 i32 i64 isize f32 f64 u128 i128 String);
    macro_rules ! iter_scan_tuple_impl { ($ ($ T : ident) *) => { impl <$ ($ T : IterScan) ,*> IterScan for ($ ($ T ,) *) { type Output = ($ (<$ T as IterScan >:: Output ,) *) ; # [inline] fn scan <'a , It : Iterator < Item = &'a str >> (_iter : & mut It) -> Option < Self :: Output > { Some (($ (<$ T as IterScan >:: scan (_iter) ?,) *)) } } } ; }
    iter_scan_tuple_impl!();
    iter_scan_tuple_impl!(A);
    iter_scan_tuple_impl ! (A B);
    iter_scan_tuple_impl ! (A B C);
    iter_scan_tuple_impl ! (A B C D);
    iter_scan_tuple_impl ! (A B C D E);
    iter_scan_tuple_impl ! (A B C D E F);
    iter_scan_tuple_impl ! (A B C D E F G);
    iter_scan_tuple_impl ! (A B C D E F G H);
    iter_scan_tuple_impl ! (A B C D E F G H I);
    iter_scan_tuple_impl ! (A B C D E F G H I J);
    iter_scan_tuple_impl ! (A B C D E F G H I J K);
    pub struct ScannerIter<'a, 'b, T> {
        inner: &'b mut Scanner<'a>,
        _marker: std::marker::PhantomData<fn() -> T>,
    }
    impl<'a, 'b, T> Iterator for ScannerIter<'a, 'b, T>
    where
        T: IterScan,
    {
        type Item = <T as IterScan>::Output;
        #[inline]
        fn next(&mut self) -> Option<Self::Item> {
            <T as IterScan>::scan(&mut self.inner.iter)
        }
    }
}
pub use marker_impls::{CharWithBase, Chars, CharsWithBase, Collect, SizedCollect, Usize1};
mod marker_impls {
    use super::*;
    use std::{
        iter::{repeat_with, FromIterator},
        marker::PhantomData,
    };
    #[derive(Debug, Copy, Clone)]
    pub struct Usize1;
    impl IterScan for Usize1 {
        type Output = usize;
        #[inline]
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output> {
            <usize as IterScan>::scan(iter)?.checked_sub(1)
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct CharWithBase(pub char);
    impl MarkedIterScan for CharWithBase {
        type Output = usize;
        #[inline]
        fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output> {
            Some((<char as IterScan>::scan(iter)? as u8 - self.0 as u8) as usize)
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct Chars;
    impl IterScan for Chars {
        type Output = Vec<char>;
        #[inline]
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output> {
            Some(iter.next()?.chars().collect())
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct CharsWithBase(pub char);
    impl MarkedIterScan for CharsWithBase {
        type Output = Vec<usize>;
        #[inline]
        fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output> {
            Some(
                iter.next()?
                    .chars()
                    .map(|c| (c as u8 - self.0 as u8) as usize)
                    .collect(),
            )
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct Collect<T, B = Vec<<T as IterScan>::Output>>
    where
        T: IterScan,
        B: FromIterator<<T as IterScan>::Output>,
    {
        size: usize,
        _marker: PhantomData<fn() -> (T, B)>,
    }
    impl<T, B> Collect<T, B>
    where
        T: IterScan,
        B: FromIterator<<T as IterScan>::Output>,
    {
        pub fn new(size: usize) -> Self {
            Self {
                size,
                _marker: PhantomData,
            }
        }
    }
    impl<T, B> MarkedIterScan for Collect<T, B>
    where
        T: IterScan,
        B: FromIterator<<T as IterScan>::Output>,
    {
        type Output = B;
        #[inline]
        fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output> {
            repeat_with(|| <T as IterScan>::scan(iter))
                .take(self.size)
                .collect()
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct SizedCollect<T, B = Vec<<T as IterScan>::Output>>
    where
        T: IterScan,
        B: FromIterator<<T as IterScan>::Output>,
    {
        _marker: PhantomData<fn() -> (T, B)>,
    }
    impl<T, B> IterScan for SizedCollect<T, B>
    where
        T: IterScan,
        B: FromIterator<<T as IterScan>::Output>,
    {
        type Output = B;
        #[inline]
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output> {
            let size = usize::scan(iter)?;
            repeat_with(|| <T as IterScan>::scan(iter))
                .take(size)
                .collect()
        }
    }
}
#[macro_export]
macro_rules ! scan_value { ($ scanner : expr , ($ ($ t : tt) ,*)) => { ($ ($ crate :: scan_value ! ($ scanner , $ t)) ,*) } ; ($ scanner : expr , [$ t : tt ; $ len : expr]) => { (0 ..$ len) . map (| _ | $ crate :: scan_value ! ($ scanner , $ t)) . collect ::< Vec < _ >> () } ; ($ scanner : expr , [$ t : ty ; $ len : expr]) => { $ scanner . scan_vec ::<$ t > ($ len) } ; ($ scanner : expr , [$ t : ty]) => { $ scanner . iter ::<$ t > () } ; ($ scanner : expr , { $ e : expr }) => { $ scanner . mscan ($ e) } ; ($ scanner : expr , $ t : ty) => { $ scanner . scan ::<$ t > () } ; }
#[macro_export]
macro_rules ! scan { ($ scanner : expr) => { } ; ($ scanner : expr ,) => { } ; ($ scanner : expr , mut $ var : tt : $ t : tt) => { let mut $ var = $ crate :: scan_value ! ($ scanner , $ t) ; } ; ($ scanner : expr , $ var : tt : $ t : tt) => { let $ var = $ crate :: scan_value ! ($ scanner , $ t) ; } ; ($ scanner : expr , mut $ var : tt : $ t : tt , $ ($ rest : tt) *) => { let mut $ var = $ crate :: scan_value ! ($ scanner , $ t) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , $ var : tt : $ t : tt , $ ($ rest : tt) *) => { let $ var = $ crate :: scan_value ! ($ scanner , $ t) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , mut $ var : tt) => { let mut $ var = $ crate :: scan_value ! ($ scanner , usize) ; } ; ($ scanner : expr , $ var : tt) => { let $ var = $ crate :: scan_value ! ($ scanner , usize) ; } ; ($ scanner : expr , mut $ var : tt , $ ($ rest : tt) *) => { let mut $ var = $ crate :: scan_value ! ($ scanner , usize) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , $ var : tt , $ ($ rest : tt) *) => { let $ var = $ crate :: scan_value ! ($ scanner , usize) ; scan ! ($ scanner , $ ($ rest) *) } ; }
pub mod mint_basic {
    use super::*;
    #[macro_export]
    macro_rules ! define_basic_mintbase { ($ name : ident , $ m : expr , $ basety : ty , $ signedty : ty , $ upperty : ty , [$ ($ unsigned : ty) ,*] , [$ ($ signed : ty) ,*]) => { pub struct $ name ; impl MIntBase for $ name { type Inner = $ basety ; # [inline] fn get_mod () -> Self :: Inner { $ m } # [inline] fn mod_zero () -> Self :: Inner { 0 } # [inline] fn mod_one () -> Self :: Inner { 1 } # [inline] fn mod_add (x : Self :: Inner , y : Self :: Inner) -> Self :: Inner { let z = x + y ; let m = Self :: get_mod () ; if z >= m { z - m } else { z } } # [inline] fn mod_sub (x : Self :: Inner , y : Self :: Inner) -> Self :: Inner { if x < y { x + Self :: get_mod () - y } else { x - y } } # [inline] fn mod_mul (x : Self :: Inner , y : Self :: Inner) -> Self :: Inner { (x as $ upperty * y as $ upperty % Self :: get_mod () as $ upperty) as $ basety } # [inline] fn mod_div (x : Self :: Inner , y : Self :: Inner) -> Self :: Inner { Self :: mod_mul (x , Self :: mod_inv (y)) } # [inline] fn mod_neg (x : Self :: Inner) -> Self :: Inner { if x == 0 { 0 } else { Self :: get_mod () - x } } fn mod_inv (x : Self :: Inner) -> Self :: Inner { let p = Self :: get_mod () as $ signedty ; let (mut a , mut b) = (x as $ signedty , p) ; let (mut u , mut x) = (1 , 0) ; while a != 0 { let k = b / a ; x -= k * u ; b -= k * a ; std :: mem :: swap (& mut x , & mut u) ; std :: mem :: swap (& mut b , & mut a) ; } (if x < 0 { x + p } else { x }) as _ } } $ (impl MIntConvert <$ unsigned > for $ name { # [inline] fn from (x : $ unsigned) -> Self :: Inner { (x % < Self as MIntBase >:: get_mod () as $ unsigned) as $ basety } # [inline] fn into (x : Self :: Inner) -> $ unsigned { x as $ unsigned } # [inline] fn mod_into () -> $ unsigned { < Self as MIntBase >:: get_mod () as $ unsigned } }) * $ (impl MIntConvert <$ signed > for $ name { # [inline] fn from (x : $ signed) -> Self :: Inner { let x = x % < Self as MIntBase >:: get_mod () as $ signed ; if x < 0 { (x + < Self as MIntBase >:: get_mod () as $ signed) as $ basety } else { x as $ basety } } # [inline] fn into (x : Self :: Inner) -> $ signed { x as $ signed } # [inline] fn mod_into () -> $ signed { < Self as MIntBase >:: get_mod () as $ signed } }) * } ; }
    #[macro_export]
    macro_rules ! define_basic_mint32 { ($ ([$ name : ident , $ m : expr , $ mint_name : ident]) ,*) => { $ (crate :: define_basic_mintbase ! ($ name , $ m , u32 , i32 , u64 , [u32 , u64 , u128 , usize] , [i32 , i64 , i128 , isize]) ; pub type $ mint_name = MInt <$ name >;) * } ; }
    define_basic_mint32!(
        [Modulo998244353, 998_244_353, MInt998244353],
        [Modulo1000000007, 1_000_000_007, MInt1000000007],
        [Modulo1000000009, 1_000_000_009, MInt1000000009],
        [
            DynModuloU32,
            DYN_MODULUS_U32.with(|cell| unsafe { *cell.get() }),
            DynMIntU32
        ]
    );
    thread_local ! (static DYN_MODULUS_U32 : std :: cell :: UnsafeCell < u32 > = std :: cell :: UnsafeCell :: new (1_000_000_007));
    impl DynModuloU32 {
        pub fn set_mod(m: u32) {
            DYN_MODULUS_U32.with(|cell| unsafe { *cell.get() = m })
        }
    }
    thread_local ! (static DYN_MODULUS_U64 : std :: cell :: UnsafeCell < u64 > = std :: cell :: UnsafeCell :: new (1_000_000_007));
    define_basic_mintbase!(
        DynModuloU64,
        DYN_MODULUS_U64.with(|cell| unsafe { *cell.get() }),
        u64,
        i64,
        u128,
        [u64, u128, usize],
        [i64, i128, isize]
    );
    impl DynModuloU64 {
        pub fn set_mod(m: u64) {
            DYN_MODULUS_U64.with(|cell| unsafe { *cell.get() = m })
        }
    }
    pub type DynMIntU64 = MInt<DynModuloU64>;
    pub struct Modulo2;
    impl MIntBase for Modulo2 {
        type Inner = u32;
        #[inline]
        fn get_mod() -> Self::Inner {
            2
        }
        #[inline]
        fn mod_zero() -> Self::Inner {
            0
        }
        #[inline]
        fn mod_one() -> Self::Inner {
            1
        }
        #[inline]
        fn mod_add(x: Self::Inner, y: Self::Inner) -> Self::Inner {
            x ^ y
        }
        #[inline]
        fn mod_sub(x: Self::Inner, y: Self::Inner) -> Self::Inner {
            x ^ y
        }
        #[inline]
        fn mod_mul(x: Self::Inner, y: Self::Inner) -> Self::Inner {
            x | y
        }
        #[inline]
        fn mod_div(x: Self::Inner, y: Self::Inner) -> Self::Inner {
            assert_ne!(y, 0);
            x
        }
        #[inline]
        fn mod_neg(x: Self::Inner) -> Self::Inner {
            x
        }
        #[inline]
        fn mod_inv(x: Self::Inner) -> Self::Inner {
            assert_ne!(x, 0);
            x
        }
        #[inline]
        fn mod_pow(x: Self::Inner, y: usize) -> Self::Inner {
            if y == 0 {
                1
            } else {
                x
            }
        }
    }
    macro_rules ! impl_to_mint_base_for_modulo2 { ($ name : ident , $ basety : ty , [$ ($ t : ty) ,*]) => { $ (impl MIntConvert <$ t > for $ name { # [inline] fn from (x : $ t) -> Self :: Inner { (x & 1) as $ basety } # [inline] fn into (x : Self :: Inner) -> $ t { x as $ t } # [inline] fn mod_into () -> $ t { 1 } }) * } ; }
    impl_to_mint_base_for_modulo2!(
        Modulo2,
        u32,
        [u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize]
    );
    pub type MInt2 = MInt<Modulo2>;
}
#[repr(transparent)]
pub struct MInt<M>
where
    M: MIntBase,
{
    x: M::Inner,
    _marker: std::marker::PhantomData<fn() -> M>,
}
pub trait MIntBase {
    type Inner: Sized + Copy + Eq + std::fmt::Debug + std::hash::Hash;
    fn get_mod() -> Self::Inner;
    fn mod_zero() -> Self::Inner;
    fn mod_one() -> Self::Inner;
    fn mod_add(x: Self::Inner, y: Self::Inner) -> Self::Inner;
    fn mod_sub(x: Self::Inner, y: Self::Inner) -> Self::Inner;
    fn mod_mul(x: Self::Inner, y: Self::Inner) -> Self::Inner;
    fn mod_div(x: Self::Inner, y: Self::Inner) -> Self::Inner;
    fn mod_neg(x: Self::Inner) -> Self::Inner;
    fn mod_inv(x: Self::Inner) -> Self::Inner;
    fn mod_pow(x: Self::Inner, y: usize) -> Self::Inner {
        let (mut x, mut y, mut z) = (x, y, Self::mod_one());
        while y > 0 {
            if y & 1 == 1 {
                z = Self::mod_mul(z, x);
            }
            x = Self::mod_mul(x, x);
            y >>= 1;
        }
        z
    }
}
pub trait MIntConvert<T = <Self as MIntBase>::Inner>: MIntBase {
    fn from(x: T) -> <Self as MIntBase>::Inner;
    fn into(x: <Self as MIntBase>::Inner) -> T;
    fn mod_into() -> T;
}
mod mint_base {
    use super::*;
    use std::{
        fmt::{self, Debug, Display},
        hash::{Hash, Hasher},
        iter::{Product, Sum},
        marker::PhantomData,
        ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},
        str::FromStr,
    };
    impl<M> MInt<M>
    where
        M: MIntConvert,
    {
        #[inline]
        pub fn new(x: M::Inner) -> Self {
            Self::new_unchecked(<M as MIntConvert<M::Inner>>::from(x))
        }
        #[inline]
        pub fn inner(self) -> M::Inner {
            <M as MIntConvert<M::Inner>>::into(self.x)
        }
    }
    impl<M> MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        pub fn new_unchecked(x: M::Inner) -> Self {
            Self {
                x,
                _marker: PhantomData,
            }
        }
        #[inline]
        pub fn get_mod() -> M::Inner {
            M::get_mod()
        }
        #[inline]
        pub fn pow(self, y: usize) -> Self {
            Self::new_unchecked(M::mod_pow(self.x, y))
        }
        #[inline]
        pub fn inv(self) -> Self {
            Self::new_unchecked(M::mod_inv(self.x))
        }
    }
    impl<M> Clone for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn clone(&self) -> Self {
            Self {
                x: Clone::clone(&self.x),
                _marker: PhantomData,
            }
        }
    }
    impl<M> Copy for MInt<M> where M: MIntBase {}
    impl<M> Debug for MInt<M>
    where
        M: MIntBase,
    {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            Debug::fmt(&self.x, f)
        }
    }
    impl<M> Default for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn default() -> Self {
            <Self as Zero>::zero()
        }
    }
    impl<M> PartialEq for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn eq(&self, other: &Self) -> bool {
            PartialEq::eq(&self.x, &other.x)
        }
    }
    impl<M> Eq for MInt<M> where M: MIntBase {}
    impl<M> Hash for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn hash<H: Hasher>(&self, state: &mut H) {
            Hash::hash(&self.x, state)
        }
    }
    macro_rules ! impl_mint_from { ($ ($ t : ty) ,*) => { $ (impl < M > From <$ t > for MInt < M > where M : MIntConvert <$ t >, { # [inline] fn from (x : $ t) -> Self { Self :: new_unchecked (< M as MIntConvert <$ t >>:: from (x)) } } impl < M > From < MInt < M >> for $ t where M : MIntConvert <$ t >, { # [inline] fn from (x : MInt < M >) -> $ t { < M as MIntConvert <$ t >>:: into (x . x) } }) * } ; }
    impl_mint_from!(u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize);
    impl<M> Zero for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn zero() -> Self {
            Self::new_unchecked(M::mod_zero())
        }
    }
    impl<M> One for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn one() -> Self {
            Self::new_unchecked(M::mod_one())
        }
    }
    impl<M> Add for MInt<M>
    where
        M: MIntBase,
    {
        type Output = Self;
        #[inline]
        fn add(self, rhs: Self) -> Self::Output {
            Self::new_unchecked(M::mod_add(self.x, rhs.x))
        }
    }
    impl<M> Sub for MInt<M>
    where
        M: MIntBase,
    {
        type Output = Self;
        #[inline]
        fn sub(self, rhs: Self) -> Self::Output {
            Self::new_unchecked(M::mod_sub(self.x, rhs.x))
        }
    }
    impl<M> Mul for MInt<M>
    where
        M: MIntBase,
    {
        type Output = Self;
        #[inline]
        fn mul(self, rhs: Self) -> Self::Output {
            Self::new_unchecked(M::mod_mul(self.x, rhs.x))
        }
    }
    impl<M> Div for MInt<M>
    where
        M: MIntBase,
    {
        type Output = Self;
        #[inline]
        fn div(self, rhs: Self) -> Self::Output {
            Self::new_unchecked(M::mod_div(self.x, rhs.x))
        }
    }
    impl<M> Neg for MInt<M>
    where
        M: MIntBase,
    {
        type Output = Self;
        #[inline]
        fn neg(self) -> Self::Output {
            Self::new_unchecked(M::mod_neg(self.x))
        }
    }
    impl<M> Sum for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
            iter.fold(<Self as Zero>::zero(), Add::add)
        }
    }
    impl<M> Product for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
            iter.fold(<Self as One>::one(), Mul::mul)
        }
    }
    impl<'a, M: 'a> Sum<&'a MInt<M>> for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self {
            iter.fold(<Self as Zero>::zero(), Add::add)
        }
    }
    impl<'a, M: 'a> Product<&'a MInt<M>> for MInt<M>
    where
        M: MIntBase,
    {
        #[inline]
        fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self {
            iter.fold(<Self as One>::one(), Mul::mul)
        }
    }
    impl<M> Display for MInt<M>
    where
        M: MIntConvert,
        M::Inner: Display,
    {
        fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> Result<(), fmt::Error> {
            write!(f, "{}", self.inner())
        }
    }
    impl<M> FromStr for MInt<M>
    where
        M: MIntConvert,
        M::Inner: FromStr,
    {
        type Err = <M::Inner as FromStr>::Err;
        #[inline]
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            s.parse::<M::Inner>().map(Self::new)
        }
    }
    impl<M> IterScan for MInt<M>
    where
        M: MIntConvert,
        M::Inner: FromStr,
    {
        type Output = Self;
        #[inline]
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output> {
            iter.next()?.parse::<MInt<M>>().ok()
        }
    }
    macro_rules! impl_mint_ref_binop {
        ($ imp : ident , $ method : ident , $ t : ty) => {
            impl<M> $imp<$t> for &$t
            where
                M: MIntBase,
            {
                type Output = <$t as $imp<$t>>::Output;
                #[inline]
                fn $method(self, other: $t) -> <$t as $imp<$t>>::Output {
                    $imp::$method(*self, other)
                }
            }
            impl<M> $imp<&$t> for $t
            where
                M: MIntBase,
            {
                type Output = <$t as $imp<$t>>::Output;
                #[inline]
                fn $method(self, other: &$t) -> <$t as $imp<$t>>::Output {
                    $imp::$method(self, *other)
                }
            }
            impl<M> $imp<&$t> for &$t
            where
                M: MIntBase,
            {
                type Output = <$t as $imp<$t>>::Output;
                #[inline]
                fn $method(self, other: &$t) -> <$t as $imp<$t>>::Output {
                    $imp::$method(*self, *other)
                }
            }
        };
    }
    impl_mint_ref_binop!(Add, add, MInt<M>);
    impl_mint_ref_binop!(Sub, sub, MInt<M>);
    impl_mint_ref_binop!(Mul, mul, MInt<M>);
    impl_mint_ref_binop!(Div, div, MInt<M>);
    macro_rules! impl_mint_ref_unop {
        ($ imp : ident , $ method : ident , $ t : ty) => {
            impl<M> $imp for &$t
            where
                M: MIntBase,
            {
                type Output = <$t as $imp>::Output;
                #[inline]
                fn $method(self) -> <$t as $imp>::Output {
                    $imp::$method(*self)
                }
            }
        };
    }
    impl_mint_ref_unop!(Neg, neg, MInt<M>);
    macro_rules! impl_mint_ref_op_assign {
        ($ imp : ident , $ method : ident , $ t : ty , $ fromimp : ident , $ frommethod : ident) => {
            impl<M> $imp<$t> for $t
            where
                M: MIntBase,
            {
                #[inline]
                fn $method(&mut self, rhs: $t) {
                    *self = $fromimp::$frommethod(*self, rhs);
                }
            }
            impl<M> $imp<&$t> for $t
            where
                M: MIntBase,
            {
                #[inline]
                fn $method(&mut self, other: &$t) {
                    $imp::$method(self, *other);
                }
            }
        };
    }
    impl_mint_ref_op_assign!(AddAssign, add_assign, MInt<M>, Add, add);
    impl_mint_ref_op_assign!(SubAssign, sub_assign, MInt<M>, Sub, sub);
    impl_mint_ref_op_assign!(MulAssign, mul_assign, MInt<M>, Mul, mul);
    impl_mint_ref_op_assign!(DivAssign, div_assign, MInt<M>, Div, div);
}
pub trait Zero: Sized {
    fn zero() -> Self;
    #[inline]
    fn is_zero(&self) -> bool
    where
        Self: PartialEq,
    {
        self == &Self::zero()
    }
    #[inline]
    fn set_zero(&mut self) {
        *self = Self::zero();
    }
}
pub trait One: Sized {
    fn one() -> Self;
    #[inline]
    fn is_one(&self) -> bool
    where
        Self: PartialEq,
    {
        self == &Self::one()
    }
    #[inline]
    fn set_one(&mut self) {
        *self = Self::one();
    }
}
macro_rules ! zero_one_impls { ($ ({ $ Trait : ident $ method : ident $ ($ t : ty) *, $ e : expr }) *) => { $ ($ (impl $ Trait for $ t { fn $ method () -> Self { $ e } }) *) * } ; }
zero_one_impls ! ({ Zero zero u8 u16 u32 u64 usize i8 i16 i32 i64 isize u128 i128 , 0 } { Zero zero f32 f64 , 0. } { One one u8 u16 u32 u64 usize i8 i16 i32 i64 isize u128 i128 , 1 } { One one f32 f64 , 1. });
#[derive(Clone, Debug)]
pub struct PrimeTable {
    table: Vec<u32>,
}
impl PrimeTable {
    pub fn new(max_n: u32) -> Self {
        let mut table = vec![1; (max_n as usize + 1) / 2];
        table[0] = 0;
        for i in (3..).step_by(2) {
            let i2 = i * i;
            if i2 > max_n {
                break;
            }
            if table[i as usize >> 1] == 1 {
                for j in (i2..=max_n).step_by(i as usize * 2) {
                    if table[j as usize >> 1] == 1 {
                        table[j as usize >> 1] = i;
                    }
                }
            }
        }
        PrimeTable { table }
    }
    pub fn is_prime(&self, n: u32) -> bool {
        n == 2 || n % 2 == 1 && self.table[n as usize >> 1] == 1
    }
    pub fn for_each<F>(&self, mut n: u32, mut f: F)
    where
        F: FnMut(u32, u32),
    {
        let k = n.trailing_zeros();
        if k > 0 {
            f(2, k);
        }
        n >>= k;
        while self.table[n as usize >> 1] > 1 {
            let p = self.table[n as usize >> 1];
            let mut cnt = 1;
            n /= p;
            while self.table[n as usize >> 1] == p {
                n /= p;
                cnt += 1;
            }
            if n == p {
                cnt += 1;
                n /= p;
            }
            f(p, cnt);
        }
        if n > 1 {
            f(n, 1);
        }
    }
    pub fn prime_factors(&self, n: u32) -> Vec<(u32, u32)> {
        let mut factors = vec![];
        self.for_each(n, |p, c| factors.push((p, c)));
        factors
    }
    pub fn count_divisors(&self, n: u32) -> u32 {
        let mut divisor_cnt = 1;
        self.for_each(n, |_, cnt| divisor_cnt *= cnt + 1);
        divisor_cnt
    }
}


mod cp {
    use std::io::prelude::*;
    pub fn stdin_to_string() -> String {
        let mut content = String::new();
        let stdin = std::io::stdin();
        let mut rd = stdin.lock();
        rd.read_to_string(&mut content).unwrap();
        return content;
    }

    pub struct Parser<'a> {
        tokens: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Parser<'a> {
        pub fn new(text: &'a str) -> Self {
            Self {
                tokens: text.split_whitespace(),
            }
        }

        pub fn read_or_eof<T: std::str::FromStr>(&mut self) -> Option<T> {
            self.next().map(|s| match s.parse() {
                Ok(x) => x,
                Err(_) => panic!("cannot parse {:?}", s),
            })
        }

        pub fn read<T: std::str::FromStr>(&mut self) -> T {
            self.read_or_eof::<T>().expect("unexpected end-of-file")
        }
    }

    impl<'a> Iterator for Parser<'a> {
        type Item = &'a str;
        fn next(&mut self) -> Option<&'a str> {
            self.tokens.next()
        }
    }

    #[macro_export]
    macro_rules! take {
        ($p: expr, $n: expr) => {
            $p.by_ref().take($n).map(|x| x.parse().unwrap())
        };
        ($p: expr, $n: expr, $t: ty) => {
            $p.by_ref().take($n).map(|x| x.parse::<$t>().unwrap())
        };
    }

    #[macro_export]
    macro_rules! take_all {
        ($p: expr) => {
            $p.by_ref().map(|x| x.parse().unwrap())
        };
        ($p: expr, $t: ty) => {
            $p.by_ref().map(|x| x.parse::<$t>().unwrap())
        };
    }
}

use cp::*;

fn main() {
    let content = stdin_to_string();
    let mut inp = Parser::new(&content);

    let mut nd = vec![0i32; 1000001];
    for i in 1..=1000000 {
        for j in (i..=1000000).step_by(i) {
            nd[j] += 1;
        }
    }

    let mut f = vec![0i32; 2000001];
    let mut sum = 0i64;
    for i in (2..=2000000).step_by(2) {
        let t = nd[i / 2] as i64 + sum;
        f[i] = (t % 998244353) as i32;
        sum += f[i] as i64;
    }
    let n: usize = inp.read();
    println!("{}", f[n * 2]);
}


use std::io;
use std::io::BufRead;

const MAX_SCORE: usize = 600;

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();

    lines.next().unwrap().expect("input reading failed");
    let input_string = lines.next().unwrap().ok().unwrap();

    let mut awarded = [false; MAX_SCORE + 1];
    let mut count = 0;
    input_string.split(" ").map(|x| x.parse::<u16>().unwrap()).filter(|x| *x > 0).for_each(|x| {
            let index = x as usize;
            if !awarded[index] {
                awarded[index] = true;
                count += 1;
            }
        });

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


use std::io;

fn read_line() -> String {
    let mut input_line = String::new();
    io::stdin().read_line(&mut input_line).unwrap();
    return String::from(input_line.trim());
}

fn read_line_vec() -> Vec<usize> {
    return read_line().split(' ')
        .map(|s| s.parse().unwrap())
        .collect();
}

fn main() {
    let n: i32 = read_line().parse().unwrap();
    let mut vs = read_line_vec();

    vs.sort();
    vs.dedup();

    for i in 2..vs.len() {
        let pprev = vs[i-2];
        let prev = vs[i-1];
        let me = vs[i];

        if me == prev + 1 && pprev + 1 == prev {
            println!("YES");
            return;
        }
    }

    println!("NO");

}


//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")
    };
}

//

fn run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut a = a;
    a.sort();
    a.dedup();
    let n = a.len();
    let mut ans = "NO";
    for i in 2..n {
        let s = a[i - 2];
        if a[(i - 2)..=i] == [s, s + 1, s + 2] {
            ans = "YES";
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


use std::io;

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).expect("err");
    let mut n:i64 = buffer.trim().parse().unwrap();
    let mut d = 0;
    for i in 2..=(n as f64).sqrt() as i64 + 1{
        if n % i == 0 {
            d = i; n -= d;
            break;
        }
    }
    println!("{}",
        if d != 0 {
            n/2+1
        } else {
            1
        }
    );
}


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

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buffer: vec![],
        }
    }

    pub fn token<T: 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();
            self.reader.read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n: i64 = scan.token();
    let m: i64 = scan.token();
    let mut ans: i64 = 0;
    for x in 1..=n {
        // How many multiples of 5 minus x are there in [1, m]?
        ans += (m + x) / 5 - (x + 5) / 5 + 1;
    }
    writeln!(out, "{}", ans).ok();
}

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);
}


// Try Codeforces
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }

    let n = get!();
    let k = get!();
    let mut ans = 0;
    if n >= k {
        ans = (k - 1) / 2;
    } else if k <= n + (n - 1) {
        let x = k - n;
        ans = (n - x + 1) / 2;
    }

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


//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_macros)]
macro_rules! m {
    ($c:tt, $x:expr, $y:expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
#[allow(unused_macros)]
macro_rules! l {
    ($($v:ident),* = $i:ident.$f:ident $a:tt) => {
        $( let $v = $i.$f$a; )*
    };
    ($($v:ident),*:$t:ty = $i:ident.$f:ident $a:tt) => {
        $( let $v:$t = $i.$f$a; )*
    };
}
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 f(&mut self) ->    f64 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn sk(&mut self, n: usize) { self.it.nth(n - 1); }
    fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> {
        self.ip(n).into_iter()
    }
    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 ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
        self.vp(n).into_iter()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}
//------------------- End rusT

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

    let a = input.bs().to_vec();
    let b = input.bs().to_vec();
    let mut i = 0;
    for c in b {
        if c == a[i] {
            i += 1;
        }
    }
    println!("{}", i + 1);
}


#![allow(unused_imports)]
#![allow(unused_macros)]
use std::io::{StdinLock, stdin, BufRead};
use std::collections::*;
use std::cmp::*;

fn scan_helper(lock : &mut StdinLock) -> String {
    let mut buffer = String::new();
    lock.read_line(&mut buffer).ok();
    buffer
}

macro_rules! scan {
    ($lock:ident, $t:ty) => ({
        scan_helper(&mut $lock).split_whitespace()
            .next().unwrap()
            .parse::<$t>().unwrap()
    });
    ($lock:ident, $($t:ty),+) => ({
        let buffer = scan_helper(&mut $lock);
        let mut iter = buffer.split_whitespace();
        ($(
            {
                iter.next().unwrap()
                    .parse::<$t>().unwrap()
            },
        )+)
    })
}

macro_rules! scan_iter {
    ($lock:ident, $t:ty) => ({
        scan_helper(&mut $lock).split_whitespace()
            .map(|x| x.parse::<$t>().unwrap())
            .collect()
    })
}

trait Ext {
    fn idx(&self) -> usize;
    fn num(&self) -> i64;
}

macro_rules! ext {
    ($t:ty) => (
        impl Ext for $t {
            #[inline]
            fn idx(&self) -> usize {
                *self as usize
            }

            #[inline]
            fn num(&self) -> i64 {
                *self as i64
            }
        }
    )
}
ext!(i64);
ext!(usize);

macro_rules! derive_regular {
    ($t:ty) => (
        impl Ord for $t {
            fn cmp(&self, other : &$t) -> Ordering {
                self.partial_cmp(other).unwrap()
            }
        }
        impl PartialEq for $t {
            fn eq(&self, other : &$t) -> bool {
                self.cmp(other) == Ordering::Equal
            }
        }
        impl Eq for $t {}
    )
}

fn main() {
    let stdin = stdin();
    let mut s = stdin.lock();
    let n = scan!(s, usize);
    let max_n = 1000000;
    let mut squares = vec![2*max_n; 2001];
    squares[0] = 0;

    let mut i = 1;
    while i*i <= max_n {
        squares[i] = i*i;
        i += 1;
    }

    while squares[i] > n {
        i -= 1;
    }

    let mut result = 4*i;
    let diff = n - squares[i];
    if diff > 0 {
        if diff > i {
            result += 4;
        } else {
            result += 2;
        }
    }

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


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

fn main(){
    let now_time = read_string().replace("\n", "").replace("\r", "");
    let sleep_time = read_string().replace("\n", "").replace("\r", "");
    let now_vec: Vec<&str> = now_time.split(":").collect();
    let sleep_vec: Vec<&str> = sleep_time.split(":").collect();
    let fix = if now_vec[1].parse::<i16>().unwrap() < sleep_vec[1].parse::<i16>().unwrap() {1} else {0};
    let mut hours = now_vec[0].parse::<i16>().unwrap() - (sleep_vec[0].parse::<i16>().unwrap()+fix);
    let mut minutes =  now_vec[1].parse::<i16>().unwrap() - sleep_vec[1].parse::<i16>().unwrap();
    if hours < 0{
        hours = 24+hours;
    }
    if minutes < 0{
        minutes = 60+minutes;
    }
    println!("{}{}:{}{}", if hours<10 {"0"} else {""}, hours, if minutes<10 {"0"} else {""},minutes);
    }


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

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buffer: vec![],
        }
    }

    pub fn token<T: 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();
            self.reader.read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn get_divisors(n: u64) -> Vec<u64> {
    let mut ans = vec![1];
    if n > 1 {
        ans.push(n);
    }
    let mut d = 2;
    while d * d <= n {
        if n % d == 0 {
            ans.push(d);
            if d * d < n {
                ans.push(n / d);
            }
        }
        d += 1;
    }
    ans.sort();
    ans
}

fn upper_bound(arr: &[u64], target: u64) -> usize {
    let mut lo = 0;
    let mut hi = arr.len();
    while lo < hi {
        let mid = lo + (hi - lo) / 2;
        if arr[mid] > target {
            hi = mid;
        } else {
            lo = mid + 1;
        }
    }
    lo
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let a: u64 = scan.token();
    let b: u64 = scan.token();
    if a == 0 {
        if b == 0 {
            writeln!(out, "infinity").ok();
        } else {
            writeln!(out, "0").ok();
        }
    } else {
        if a < b {
            writeln!(out, "0").ok();
        } else if a == b {
            writeln!(out, "infinity").ok();
        } else {
            // Solve the modular equation a ≡ b (mod x).
            // a = x * k + b, where k is some integer.
            // (a - b) = x * k -> x is a divisor of (a - b)
            // Count divisors of (a - b) such that x > b.
            let divisors = get_divisors(a - b);
            let ub = upper_bound(&divisors, b);
            let ans = divisors.len() - ub;
            writeln!(out, "{}", ans).ok();
        }
    }
}

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);
}


use std::io;
use io::BufRead;

fn main() {
    let stdin = io::stdin();
    let mut input = stdin.lock().lines().flat_map(
        |x| x.unwrap().split_whitespace().map(|x| x.to_string()).collect::<Vec<_>>()
    );
    let x1: i64 = input.next().unwrap().parse().unwrap();
    let y1: i64 = input.next().unwrap().parse().unwrap();
    let x2: i64 = input.next().unwrap().parse().unwrap();
    let y2: i64 = input.next().unwrap().parse().unwrap();
    let x: i64 = input.next().unwrap().parse().unwrap();
    let y: i64 = input.next().unwrap().parse().unwrap();

    if ((x2 - x1) % x != 0) || ((y2 - y1) % y != 0) {
        println!("NO");
        return;
    }

    let dx = (x2 - x1) / x;
    let dy = (y2 - y1) / y;

    if (dx + dy) % 2 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


#![allow(unused_imports)]
use std::collections::{HashSet, HashMap};
use std::cmp::{min,max};
use std::convert::TryInto;
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 let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader.read_until(b'\n', &mut self.buf_str).expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_whitespace())
            }
        }
    }
}

fn root(mut n: u32) -> u32 {
    let mut k = 0;
    while n>0 {
        k += n%10;
        n = n/10;
    }
    k
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
        let n = scan.token();
        let mut ans = root(n);
            while ans/10 != 0 { ans = root(ans)}
        writeln!(out, "{}", ans).ok();
    }

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);
}


use std::io;

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

fn solve(tag: String, pat: String) -> bool {

    let mut tag_stm = tag.chars();

    for pat_chr in pat.chars() {
        loop {
            match tag_stm.next() {
                Some(tag_chr) => {
                    if tag_chr == pat_chr {
                        break;
                    }
                }
                None => return false
            }
        }
    }
    true
}

fn main() {
    if solve(read_line().trim().to_string(), "hello".to_string()) {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let (mut f1, mut f2, mut f3, mut f4, mut f5) = (false, false, false, false, false);
    for c in s.chars() {
        if c == 'h' && !f1 {
            f1 = true;
        } else if c == 'e' && f1 && !f2 {
            f2 = true;
        } else if c == 'l' && f2 && !f3 {
            f3 = true;
        } else if c == 'l' && f3 && !f4 {
            f4 = true;
        } else if c == 'o' && f4 && !f5 {
            f5 = true;
        }
    }
    if f5 {
        println!("YES");
    } else {
        println!("NO");
    }
}


struct Scan {
    buffer: std::collections::VecDeque<String>,
}

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

    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop_front() {
                break token.parse::<T>().ok().unwrap();
            }
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).expect("Fail to read");
            self.buffer = line.split_whitespace().map(String::from).collect();
        }
    }
}

fn _main() {
    let mut scan = Scan::new();
    let input: Vec<char> = scan.next::<String>().chars().collect();
    let mut changes = 0;
    for i in 0..(input.len() / 2) {
        if input[i] != input[input.len() - i - 1] {
            changes += 1;
            if changes > 1 {
                println!("NO");
                return;
            }
        }
    }
    println!(
        "{}",
        if changes == 1 || changes == 0 && input.len() % 2 == 1 {
            "YES"
        } else {
            "NO"
        }
    );
}

fn main() {
    std::thread::Builder::new()
        .stack_size(1 << 23)
        .spawn(_main)
        .unwrap()
        .join()
        .unwrap();
}


macro_rules! parse_line {
    ($t: ty) => ({
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        let a_str = a_str.trim();
        a_str.parse::<$t>().expect("parse error")
    });
    ($($t: ty),+) => ({
        let mut a_str = String::new();
        std::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"),
            )+
        )
    })
}

#[allow(unused_macros)]
macro_rules! parse_line_to_vec {
    ($t: ty) => {{
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        (a_str
            .split_whitespace()
            .map(|x| x.parse::<$t>().unwrap())
            .collect::<Vec<$t>>())
    }};
}

use std::io::Write;

fn solve(writer: &mut std::io::BufWriter<std::io::Stdout>) {
    let n = parse_line!(usize);
    let s: Vec<u8> = parse_line!(String).bytes().collect();
    let mut counts = std::collections::HashMap::new();
    let mut best = 0;
    let mut result = Vec::new();
    for i in 1..n {
        let cnt = counts.entry(s[i - 1..=i].iter().copied().collect::<Vec<u8>>()).or_insert(0);
        *cnt += 1;
        if *cnt > best {
            best = *cnt;
            result = s[i - 1..=i].iter().copied().collect::<Vec<u8>>();
        }
    }
    writeln!(writer, "{}", String::from_utf8(result).unwrap()).unwrap();
}

fn main() {
    let mut writer = std::io::BufWriter::new(std::io::stdout());
    let tests = 1; // parse_line!(usize);
    for _ in 0..tests {
        solve(&mut writer);
    }
}


use std::io;
fn read_line() -> String {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    String::from(buffer.trim())
}
fn read_number() -> i64 {
    read_line().parse::<i64>().unwrap()
}
fn read_nums() -> Vec<i64> {
    read_line().split(' ').map(|x| x.parse::<i64>().unwrap()).collect()
}

fn main() {
    let mut nums = read_nums();
    nums.sort();
    let least = nums[0];
    let top = nums[1];
    println!("{}", if least >= 3 { least * top - least * top % 2 } else {
        if least == 1 {
            top - [0, 1, 2, 3, 2, 1][(top % 6) as usize]
        } else {
            if top <= 2 {
                0
            } else if top == 3 || top == 7 {
                least * top - 2
            } else {
                least * top
            }
        }
    });
}


#![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, 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 * //

#[derive(Clone, Debug)]
pub struct Arr2<T> {
    a: usize, b: usize, t: Vec<T>
}
impl <T: Default + Clone> Arr2<T> {
    pub fn new(a: usize, b: usize) -> Self {
        Self { a, b, t: vec![T::default(); a*b] }
    }
}
impl <T: Clone> Arr2<T> {
    pub fn filled(a: usize, b: usize, v: T) -> Self {
        Self { a, b, t: vec![v; a*b] }
    }
}
impl <T> Arr2<T> {
    pub fn idx(&self, i: usize, j: usize) -> usize {
        debug_assert!(i < self.a && j < self.b);
        i.mul(self.b).add(j)
    }

    pub fn shape(&self) -> [usize; 2] { [self.a, self.b] }
}

impl <T> Index<[usize; 2]> for Arr2<T> {
    type Output = T;

    fn index(&self, [i, j]: [usize; 2]) -> &Self::Output {
        &self.t[self.idx(i, j)]
    }
}

impl <T> IndexMut<[usize; 2]> for Arr2<T> {
    fn index_mut(&mut self, [i, j]: [usize; 2]) -> &mut Self::Output {
        let i = self.idx(i, j);
        &mut self.t[i]
    }
}

impl <T> Index<usize> for Arr2<T> {
    type Output = [T];

    fn index(&self, i: usize) -> &Self::Output {
        &self.t[i * self.b .. (i+1) * self.b]
    }
}

impl <T> IndexMut<usize> for Arr2<T> {
    fn index_mut(&mut self, i: usize) -> &mut Self::Output {
        &mut self.t[i * self.b .. (i+1) * self.b]
    }
}

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

    for _case_num in 1..=num_cases {
        let S = [1200,1400,1600,1900,2100,2300,2400,2600,3000];
        let r = read!(i32);

        let ans = *S.iter().find(|&&s| s > r).unwrap();
        println!(ans);
    }

    out_flush();
}


// ---------- begin ModInt ----------
const MOD: u32 = 1_000_000_007;

#[derive(Clone, Copy)]
struct ModInt(u32);

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

impl std::ops::AddAssign for ModInt {
    fn add_assign(&mut self, rhs: ModInt) {
        *self = *self + rhs;
    }
}

impl std::ops::Sub for ModInt {
    type Output = ModInt;
    fn sub(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + MOD - rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::SubAssign for ModInt {
    fn sub_assign(&mut self, rhs: ModInt) {
        *self = *self - rhs;
    }
}

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

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

impl std::ops::Neg for ModInt {
    type Output = ModInt;
    fn neg(self) -> Self::Output {
        ModInt(if self.0 == 0 {0} else {MOD - self.0})
    }
}

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

impl std::str::FromStr for ModInt {
    type Err = std::num::ParseIntError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let val = s.parse::<u32>()?;
        Ok(ModInt::new(val))
    }
}

#[allow(dead_code)]
impl ModInt {
    pub fn new(n: u32) -> ModInt {
        ModInt(n % MOD)
    }
    pub fn zero() -> ModInt {
        ModInt(0)
    }
    pub fn one() -> ModInt {
        ModInt(1)
    }
    pub fn pow(self, mut n: u32) -> ModInt {
        let mut t = ModInt::one();
        let mut s = self;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        t
    }
    pub fn inv(self) -> ModInt {
        self.pow(MOD - 2)
    }
}
// ---------- end ModInt ----------
// ---------- begin Precalc ----------
#[allow(dead_code)]
struct Precalc {
    inv: Vec<ModInt>,
    fact: Vec<ModInt>,
    ifact: Vec<ModInt>,
}

#[allow(dead_code)]
impl Precalc {
    pub fn new(n: usize) -> Precalc {
        let mut inv = vec![ModInt::one(); n + 1];
        let mut fact = vec![ModInt::one(); n + 1];
        let mut ifact = vec![ModInt::one(); n + 1];
        for i in 2..(n + 1) {
            inv[i] = -inv[MOD as usize % i] * ModInt(MOD / i as u32);
            fact[i] = fact[i - 1] * ModInt(i as u32);
            ifact[i] = ifact[i - 1] * inv[i];
        }
        Precalc {
            inv: inv,
            fact: fact,
            ifact: ifact,
        }
    }
    pub fn inv(&self, n: usize) -> ModInt {
        self.inv[n]
    }
    pub fn fact(&self, n: usize) -> ModInt {
        self.fact[n]
    }
    pub fn ifact(&self, n: usize) -> ModInt {
        self.ifact[n]
    }
    pub fn comb(&self, n: usize, k: usize) -> ModInt {
        if k > n {
            return ModInt::zero();
        }
        self.fact[n] * self.ifact[k] * self.ifact[n - k]
    }
}
// ---------- end Precalc ----------
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let w: usize = it.next().unwrap().parse().unwrap();
    let mut a = vec![vec![]; 3];
    for _ in 0..n {
        let t: usize = it.next().unwrap().parse().unwrap();
        let g: usize = it.next().unwrap().parse().unwrap();
        a[g - 1].push(t);
    }
    let mut way = vec![vec![vec![vec![ModInt::zero(); a[2].len() + 2]; a[1].len() + 2]; a[0].len() + 2]; 3];
    way[0][1][0][0] = ModInt::one();
    way[1][0][1][0] = ModInt::one();
    way[2][0][0][1] = ModInt::one();
    for i in 0..=a[0].len() {
        for j in 0..=a[1].len() {
            for k in 0..=a[2].len() {
                for l in 0..3 {
                    let v = way[l][i][j][k];
                    for (g, &(x, y, z)) in [(i + 1, j, k), (i, j + 1, k), (i, j, k + 1)].iter().enumerate() {
                        if g != l {
                            way[g][x][y][z] += v;
                        }
                    }
                }
            }
        }
    }
    let mut dp1 = vec![vec![vec![ModInt::zero(); w + 1]; a[1].len() + 1]; a[0].len() + 1];
    dp1[0][0][0] = ModInt::one();
    for &b in a[0].iter() {
        for i in (1..=a[0].len()).rev() {
            for t in (b..=w).rev() {
                let v = dp1[i - 1][0][t - b];
                dp1[i][0][t] += v;
            }
        }
    }
    for &b in a[1].iter() {
        for i in 0..=a[0].len() {
            for j in (1..=a[1].len()).rev() {
                for t in (b..=w).rev() {
                    let v = dp1[i][j - 1][t - b];
                    dp1[i][j][t] += v;
                }
            }
        }
    }
    let mut dp2 = vec![vec![ModInt::zero(); w + 1]; a[2].len() + 1];
    dp2[0][0] = ModInt::one();
    for &b in a[2].iter() {
        for i in (1..=a[2].len()).rev() {
            for t in (b..=w).rev() {
                let v = dp2[i - 1][t - b];
                dp2[i][t] += v;
            }
        }
    }
    let pc = Precalc::new(n);
    let mut ans = ModInt::zero();
    for i in 0..=a[0].len() {
        for j in 0..=a[1].len() {
            for k in 0..=a[2].len() {
                for t in 0..=w {
                    let way = way[0][i][j][k] + way[1][i][j][k] + way[2][i][j][k];
                    ans += dp1[i][j][t] * dp2[k][w - t] * way * pc.fact(i) * pc.fact(j) * pc.fact(k);
                }
            }
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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()
    }};
    ($($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")
        }), *)
    }};
}

use std::cmp;

fn main() {
    let (n, k) = read_line!(usize, i32);
    let a: Vec<i32> = read_line!(Vec<i32>);
    let mut cur = 0;
    let mut b = 0;
    let mut m = -1;
    for i in 0..n {
        cur += a[i];
        b += cmp::min(cur, 8);
        cur -= cmp::min(cur, 8);
        if b >= k {
            m = i as i32 + 1;
            break;
        }
    }
    println!("{}", m);
}


//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! m {
    ($c:tt, $x:expr, $y:expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
#[allow(unused_macros)]
macro_rules! l {
    ($i:ident . $e:tt : $t:ty, $($a:ident),*) => {
        $( let $a: $t = $i.$e(); )*
    };
    ($i:ident . $e:tt, $($a:ident),*) => {
        $( let $a = $i.$e(); )*
    };
}

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 f(&mut self) ->    f64 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn sk(&mut self, n: usize) { self.it.nth(n - 1); }
    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 ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
        self.vp(n).into_iter()
    }
    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.u();
    let k = input.i();
    let mut sum1 = 0;
    let mut sum2 = 0;
    for i in 0..n {
        sum1 += input.i();
        let d = sum1.min(8);
        sum1 -= d;
        sum2 += d;
        if sum2 >= k {
            println!("{}", i + 1);
            return;
        }
    }
    println!("-1");
}


#![allow(unused_imports)]
use std::cmp::Ordering::*;
use std::collections::{BTreeMap, BTreeSet};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn sqrt(x: i32) -> i32 {
    (0..=2000).find(|y| y * y >= x).unwrap()
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let mut rev = false;

    let (mut x, mut y) = scan.pair::<i32>();
    if x < 0 {
        rev = !rev;
        x = -x;
    }
    if y < 0 {
        rev = !rev;
        y = -y;
    }

    let dsq = x*x + y*y;

    let d = sqrt(dsq);

    if d * d == dsq {
        return answer!(out, "black");
    }

    answer!(out, match (d & 1 == 1) != rev {
        true => "black",
        false => "white",
    })?;

    Ok(())
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}


use std::io::{self, BufReader};
use std::io::prelude::*;
use std::collections::HashMap;

fn insert_dist(dist: i32, c: char, dist_map: &mut HashMap<char, i32>, diff: i32) {
    if dist <= (13 + diff) {
        dist_map.insert(c, (dist - diff).abs());
    } else {
        dist_map.insert(c, 26 + diff - dist);
    }
}

fn solve(input: &mut dyn Read, output: &mut dyn Write) {
    let mut reader = BufReader::new(input);
    let mut input = String::new();
    let mut dist_a: HashMap<char, i32> = HashMap::new();
    let mut dist_c: HashMap<char, i32> = HashMap::new();
    let mut dist_t: HashMap<char, i32> = HashMap::new();
    let mut dist_g: HashMap<char, i32> = HashMap::new();

    for (i, c) in "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().enumerate() {
        let dist = i as i32;
        insert_dist(dist, c, &mut dist_a, 0);
        insert_dist(dist, c, &mut dist_c, 2);
        if dist <= 6 {
            dist_t.insert(c, 7 + dist);
        } else {
            dist_t.insert(c, (dist - 19).abs());
        }
        insert_dist(dist, c, &mut dist_g, 6);
    }
    // for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars() {
    //     println!("{} {}", c, dist_t[&c]);
    // }

    reader.read_line(&mut input).unwrap();
    let n: usize = input.trim().parse().unwrap();

    input.clear();
    reader.read_line(&mut input).unwrap();
    let s = input.trim();
    // println!("{:?}", s);

    let char_vec: Vec<char> = s.chars().collect();
    let mut min_sum = -1;
    for i in 0..n-3 {
        let sum = dist_a.get(&char_vec[i]).expect("has values") +
        dist_c.get(&char_vec[i + 1]).expect("has values") +
        dist_t.get(&char_vec[i + 2]).expect("has values") +
        dist_g.get(&char_vec[i + 3]).expect("has values");

        if min_sum == -1 || sum < min_sum {
            min_sum = sum;
        }
    }

    // for c in s.chars() {
    //     println!("{:?}", c);
    // }

    writeln!(output, "{}", min_sum).expect("correct output");

}

fn main() {
    solve(&mut io::stdin(), &mut io::stdout());
}


use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();

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

    // length
    let n = input.next().unwrap();
    // route 1 (+)
    let a = input.next().unwrap();
    let x = input.next().unwrap();
    // route 2 (-)
    let b = input.next().unwrap();
    let y = input.next().unwrap();

    println!("{}", match solve(n, a, x, b, y) {
        true => "YES",
        false => "NO",
    });
}

fn solve(n: i32, a: i32, x: i32, b: i32, y: i32) -> bool {
    let x = if x < a { x + n } else { x };
    let b = if y > b { b + n } else { b };
    (y .. b + 1).rev().zip(a .. x + 1).any(|(i, j)| i % n == j % n)
}

#[cfg(test)]
mod test {

    use super::solve;
    #[test]
    fn test1() {
        assert_eq!(solve(5, 1, 4, 3, 2), true);
    }
    #[test]
    fn test2() {
        assert_eq!(solve(10, 2, 1, 9, 10), false);
    }
    #[test]
    fn test3() {
        assert_eq!(solve(82, 9, 11, 15, 79), false);
    }
    #[test]
    fn test4() {
        assert_eq!(solve(47, 15, 45, 28, 38), true);
    }
}


#![allow(unused_imports)]

use std::cmp::*;
use std::collections::*;
use std::fmt::Debug;
use std::io::{empty, Read};
use std::str::FromStr;

fn main() {
    let nn = read_vec::<usize>();
    let (n, k) = (nn[0], nn[1]);

    let first = min(k - 1, n - k);
    let result = first + 3 * n;
    println!("{}", result);
}

#[allow(dead_code)]
const DIV: i64 = 1_000_000_007;
#[allow(dead_code)]
const N: usize = 200000;
#[allow(dead_code)]
const CHARS: usize = 'z' as usize - 'a' as usize + 1;

#[allow(dead_code)]
fn print_vec<T: Debug>(a: &Vec<T>) {
    for i in 0..a.len() {
        if i != 0 {
            print!(" ");
        }
        print!("{:?}", a[i]);
    }
    println!();
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut s = String::with_capacity(N);
    std::io::stdin().read_line(&mut s).unwrap();
    s
}

#[allow(dead_code)]
fn read_vec<T: FromStr>() -> Vec<T>
    where T::Err: Debug
{
    return read_line()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
}


struct Scan {
    buffer: std::collections::VecDeque<String>,
}

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

    fn next_line(&self) -> String {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).expect("Fail to read");
        line
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop_front() {
                break token.parse::<T>().ok().unwrap();
            }
            let line = self.next_line();
            self.buffer = line.split_whitespace().map(String::from).collect();
        }
    }

    fn next_n<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next()).collect()
    }
}

fn _main() {
    let mut scan = Scan::new();
    let mut c = [0u64; 3];
    for s in scan.next::<String>().chars() {
        match s {
            'B' => {
                c[0] += 1;
            }
            'S' => {
                c[1] += 1;
            }
            'C' => {
                c[2] += 1;
            }
            _ => {}
        }
    }
    let n: Vec<u64> = scan.next_n(3);
    let p: Vec<u64> = scan.next_n(3);
    let r: u64 = scan.next();
    let mut low = 0u64;
    let mut high = 1000000001000u64;
    while low <= high {
        let middle = (low + high) / 2;
        let mut f = 0u64;
        for i in 0..3 {
            if c[i] * middle > n[i] {
                f += (c[i] * middle - n[i]) * p[i];
            }
        }
        if f <= r {
            low = middle + 1;
        } else {
            high = middle - 1;
        }
    }
    println!("{}", low - 1);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(1 << 23)
        .spawn(_main)
        .unwrap()
        .join()
        .unwrap();
}


fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("input: read line failed");
    let vec = input.trim().split_whitespace().map(|item| {
        item.parse::<i32>().expect("item: parse to i32 failed")
    }).collect::<Vec<i32>>();

    let (mut width, mut height, mut rings) = (vec[0], vec[1], vec[2]);

    let mut amount = i32::default();

    while rings > 0 {
        amount += (width + height) * 2 - 4;
        width -= 4;
        height -= 4;
        rings -= 1;
    }

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