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

    let mut it = input.split_whitespace();

    let n: u32 = it.next().unwrap().parse().unwrap();
    let a: u32 = it.next().unwrap().parse().unwrap();
    let b: u32 = it.next().unwrap().parse().unwrap();

    let oa = a - 1;
    let ob = b - 1;

    let logn = 31 - n.leading_zeros();

    let mut flag = n >> 1;
    let mut i = 0;

    let xor = oa ^ ob;

    while flag & xor == 0 {
        i += 1;
        flag >>= 1;
    }

    if flag == n >> 1 {
        println!("Final!");
    } else {
        println!("{}", logn - i)
    }
}


use std::io::{self, Write};
use std::{fmt, ops, str};

macro_rules! read {
    ( $t:ty ) => {{
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        input.trim_end().parse::<$t>().ok().unwrap()
    }};
    ( $( $t:ty ),* ) => {{
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut iter = input.split_whitespace();
        ( $( iter.next().unwrap().parse::<$t>().unwrap() ),* )
    }};
}

struct Ios(Vec<char>);

impl str::FromStr for Ios {
    type Err = ();

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        Ok(Ios(s.chars().collect()))
    }
}

impl fmt::Display for Ios {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.0.iter().collect::<String>())
    }
}

#[derive(Clone)]
struct Iov<T>(Vec<T>);

impl<T: str::FromStr> str::FromStr for Iov<T> {
    type Err = T::Err;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let iter = s.split_whitespace();
        Ok(Iov(iter.map(|x| x.parse()).collect::<Result<_, _>>()?))
    }
}

impl<T: fmt::Display> fmt::Display for Iov<T> {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}",
            self.0.iter().map(|x| x.to_string())
                .collect::<Vec<_>>().join(" ")
        )
    }
}

impl<T> ops::Index<usize> for Iov<T> {
    type Output = T;

    fn index(&self, i: usize) -> &Self::Output {
        self.0.get(i - 1).unwrap()
    }
}

impl<T> ops::IndexMut<usize> for Iov<T> {
    fn index_mut(&mut self, i: usize) -> &mut Self::Output {
        self.0.get_mut(i - 1).unwrap()
    }
}

const MOD: i64 = 1_000_000_007;

fn solve(writer: &mut io::BufWriter<io::StdoutLock>) {
    let (n, x, pos) = read!(i64, i64, i64);

    let mut ans = 1;
    let mut small = x - 1;
    let mut large = n - x;

    let mut left = 0;
    let mut right = n;
    while left < right {
        let middle = (left + right) / 2;
        if middle <= pos {
            left = middle + 1;
        } else {
            right = middle;
        }

        if middle < pos {
            ans = ans * small % MOD;
            small = small.saturating_sub(1);
        }
        if pos < middle {
            ans = ans * large % MOD;
            large = large.saturating_sub(1);
        }
    }

    let k = small + large;
    ans = ans * (1..=k).fold(1, |acc, x| acc * x % MOD) % MOD;
    writeln!(writer, "{}", ans).ok();
}

fn main() {
    let stdout = io::stdout();
    let mut writer = io::BufWriter::new(stdout.lock());
    solve(&mut writer);
}


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

    let mut it = input.split_whitespace();
    let r0 = it.next().unwrap();
    let n = r0.len();
    let r1 = it.next().unwrap();

    #[derive(Clone, Copy, Debug)]
    enum Cell {
        Empty,
        Pawn,
    }

    let mut grid: Vec<_> = r0.chars().chain(r1.chars()).map(|c| {
        match c {
            '0' => Cell::Empty,
            'X' => Cell::Pawn,
            _ => panic!("Oops!"),
        }
    }).collect();

    let f = |c| {
        match c {
            Cell::Empty => 1,
            Cell::Pawn => 0,
        }
    };

    let cnt = |c, grid: &[Cell]| {
        f(grid[c]) + f(grid[n + c])
    };

    let mut ans = 0;
    for c in 0..n {
        if cnt(c, &grid) == 2 {
            if c > 0 && cnt(c - 1, &grid) == 1 {
                grid[c] = Cell::Pawn;
                grid[n + c] = Cell::Pawn;
                ans += 1;
            } else if c + 1 < n {
                if let Cell::Empty = grid[c + 1] {
                    grid[c + 1] = Cell::Pawn;
                    grid[c] = Cell::Pawn;
                    grid[n + c] = Cell::Pawn;
                    ans += 1;
                } else if let Cell::Empty = grid[n + c + 1] {
                    grid[n + c + 1] = Cell::Pawn;
                    grid[c] = Cell::Pawn;
                    grid[n + c] = Cell::Pawn;
                    ans += 1;
                }
            }
        }
    }

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


use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::*;

// scanner from https://codeforces.com/contest/1396/submission/91365784
struct Scanner {
    stdin: Stdin,
    buffer: VecDeque<String>,
}
#[allow(dead_code)]
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
    fn u(&mut self) -> usize {
        self.cin()
    }
    fn ll(&mut self) -> i64 {
        self.cin()
    }
    fn ull(&mut self) -> u64 {
        self.cin()
    }
    fn vecu(&mut self, n: usize) -> Vec<usize> {
        self.vec(n)
    }
    fn vecll(&mut self, n: usize) -> Vec<i64> {
        self.vec(n)
    }
}

#[derive(Clone, Debug, Default)]
struct Solver {}

//
// DSU
//

#[derive(Debug, Clone)]
struct DSU {
    v: Vec<usize>,
    n: usize,
}

impl DSU {
    fn new(size: usize) -> DSU {
        let mut v = vec![0; size];
        for i in 0..size {
            v[i] = i;
        }
        DSU { v: v, n: size }
    }

    fn find(&mut self, x: usize) -> usize {
        if self.v[x] == x {
            x
        } else {
            self.v[x] = self.find(self.v[x]);
            self.v[x]
        }
    }

    fn is_same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }

    fn unify(&mut self, x: usize, y: usize) {
        let xx = self.find(x);
        let yy = self.find(y);
        if xx != yy {
            self.v[yy] = xx;
        }
    }
}

//
// Segment Tree
//

#[derive(Clone)]
struct SegmentTree<T> {
    v: Vec<T>,
    offset: usize,
    comb: fn(T, T) -> T,
    unit: T,
}

#[allow(dead_code)]
impl<T: Copy> SegmentTree<T> {
    fn new(n: usize, unit: T, comb: fn(T, T) -> T, vv: Option<&Vec<T>>) -> SegmentTree<T> {
        let mut x = 1;
        while x < n {
            x *= 2;
        }

        let mut v = vec![unit; x * 2];
        if let Some(vv) = vv {
            for i in 0..n {
                v[x + i] = (*vv)[i];
            }
            for i in (0..x).rev() {
                v[i] = comb(v[i * 2], v[i * 2 + 1]);
            }
        }

        SegmentTree {
            v: v,
            offset: x,
            comb,
            unit: unit,
        }
    }

    fn update(&mut self, pos: usize, val: T) {
        let mut p = self.offset + pos;
        self.v[p] = val;
        while p != 1 {
            p /= 2;
            self.v[p] = (self.comb)(self.v[p * 2], self.v[p * 2 + 1]);
        }
    }

    fn get(&self, pos: usize) -> T {
        self.v[self.offset + pos]
    }

    fn query_range_all(&self) -> T {
        self.query_range(0, self.offset)
    }

    fn query_range(&self, begin: usize, end: usize) -> T {
        self.query_range_sub(begin, end, 1, 0, self.offset)
    }

    // v[node] は 区間 l .. r-1 の計算結果を持っている
    fn query_range_sub(&self, begin: usize, end: usize, node: usize, l: usize, r: usize) -> T {
        if end <= l || r <= begin {
            return self.unit.clone();
        } else if begin <= l && r <= end {
            return self.v[node].clone();
        } else {
            let lval = self.query_range_sub(begin, end, node * 2, l, (l + r) / 2);
            let rval = self.query_range_sub(begin, end, node * 2 + 1, (l + r) / 2, r);
            return (self.comb)(lval, rval);
        }
    }
}

impl Solver {
    fn solve(&mut self, scan: &mut Scanner, out: &mut BufWriter<Stdout>) {
        //1416d

        let n = scan.u();
        let m = scan.u();
        let q = scan.u();
        let p = scan.vecu(n);

        let mut edges = Vec::with_capacity(m);
        for _ in 0..m {
            let x = scan.u() - 1;
            let y = scan.u() - 1;
            edges.push((x, y));
        }

        let mut vq = Vec::with_capacity(q);
        let mut vq1 = Vec::with_capacity(q); // vertex : そのグループ内の最大のpを0にする
        let mut vq2 = Vec::with_capacity(q); // edge : (edge_id, Some(r_vertex_id)) このクエリを処理するときに e_vertex_id 以降を切り離す

        let mut eid_to_q2id = vec![q; m];
        for _ in 0..q {
            let x = scan.u();
            let y = scan.u();
            vq.push(x);

            if x == 1 {
                vq1.push(y - 1);
            } else {
                eid_to_q2id[y - 1] = vq2.len();
                vq2.push((y - 1, None));
            }
        }

        /*
           エッジ削除のクエリを逆順にして、このクエリはどのグループとどのグループをくっつけるか、をDSUを使って調べる。
           x-yにエッジを追加 = (xのroot)の子として(yのroot)を追加
           x-yのエッジを削除 = (xのroot)から(yのroot)を切り離す

        */
        let mut eidq2id: Vec<(usize, usize)> = eid_to_q2id.into_iter().enumerate().collect(); // (edge_id, query2_id)
        eidq2id.sort_by_key(|x| q - x.1);

        let mut dsu = DSU::new(n);
        let mut child = vec![Vec::new(); n];
        for (edge_id, q2id) in eidq2id {
            let e = edges[edge_id];
            if !dsu.is_same(e.0, e.1) {
                let e0 = dsu.find(e.0);
                let e1 = dsu.find(e.1);
                dsu.unify(e0, e1);

                child[e0].push(e1);
                if q2id != q {
                    vq2[q2id].1 = Some(e1);
                }
            }
        }
        /*
           頂点の順番を並び替える。
           各rootからdfsで通った順にする。
           (xのroot)から(yのroot)を切り離す は、 (yのroot)の手前で分割する と同じになる
        */
        let mut pos_to_vid = Vec::with_capacity(n);
        fn dfs(vid: usize, pos_to_vid: &mut Vec<usize>, child: &Vec<Vec<usize>>) {
            pos_to_vid.push(vid);
            for &child_vid in &child[vid] {
                dfs(child_vid, pos_to_vid, child);
            }
        }

        let mut partitions = BTreeSet::new();
        partitions.insert(0);
        for i in 0..n {
            if i == dsu.find(i) {
                dfs(i, &mut pos_to_vid, &child);
            }
            partitions.insert(pos_to_vid.len());
        }

        //
        let mut vid_to_pos = vec![0; n];
        let mut v = vec![(0, 0); n];
        for pos in 0..n {
            let vid = pos_to_vid[pos];
            v[pos] = (p[vid], vid);
            vid_to_pos[vid] = pos;
        }
        let mut s = SegmentTree::new(n, (0usize, 0usize), |l, r| max(l, r), Some(&v));

        vq1.reverse();
        vq2.reverse();
        for i in 0..q {
            // for pos in 0..n {
            //     if partitions.contains(&pos) {
            //         print!("|");
            //     }
            //     let (val, vid) = s.v[s.offset + pos];
            //     print!("({} {}) ", val, vid + 1);
            // }
            // println!("");

            if vq[i] == 1 {
                let vid = vq1.pop().unwrap();
                let pos = vid_to_pos[vid];
                let lpos = partitions.range(..=pos).next_back().unwrap();
                let rpos = partitions.range(pos + 1..).next().unwrap();
                let (val2, vid2) = s.query_range(*lpos, *rpos);
                //println!("range pos{} -> {}..{}  val,vid={},{}", pos, *lpos, *rpos, val2, vid2 );
                writeln!(out, "{}", val2).ok();
                s.update(vid_to_pos[vid2], (0, vid2));
            } else {
                if let Some((_, Some(vid))) = vq2.pop() {
                    partitions.insert(vid_to_pos[vid]);
                }
            }
        }
    }
}

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

    let testcase = 1;
    //let testcase: usize = scan.cin();
    for _ in 0..testcase {
        let mut s: Solver = Default::default();
        s.solve(&mut scan, out);
    }
}

fn main() {
    let th = std::thread::Builder::new().stack_size(64 * 1024 * 1024);
    th.spawn(|| solve()).unwrap().join().unwrap()
}


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<i64> {
    return read_line().split(' ')
        .map(|s| s.parse().unwrap())
        .collect();
}

fn main() {
    read_line();
    let xs = read_line_vec();
    let s: i64 = xs.iter().sum();

    if s == 0 {
        println!("EASY");
    } else {
        println!("HARD");
    }

}


use std::io::{self, BufRead, BufReader};
use std::error::Error;
use std::str::from_utf8_unchecked as utf8;

type Result<T> = std::result::Result<T, Box<dyn Error>>;

#[inline]
unsafe fn read() -> Result<(usize, Vec<u8>)> {
    let _stdin = io::stdin();
    let mut stdin = BufReader::new(_stdin.lock());
    let mut bytes = Vec::with_capacity(100_000);

    stdin.read_until(b'\n', &mut bytes)?;
    let n = utf8(&bytes).trim_end().parse()?;

    bytes.clear();
    stdin.read_until(b'\n', &mut bytes)?;
    bytes.set_len(n);

    Ok((n, bytes))
}

pub fn main() {
    let (n, cmds) = match unsafe { read() } {
        Ok(ans) => ans,
        Err(err) => {
            println!("ERROR: {}", err);
            return
        }
    };

    let l = cmds.into_iter()
        .filter(|&ch| ch == b'L')
        .count();
    let r = n - l;

    let moves = l + r + 1;
    println!("{}", moves)
}


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


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

    let n = num.as_bytes().iter().map(|c| c - 48).filter(|&c| c == 7 || c == 4).count();
    let ret = n.to_string().chars().fold(true, |res, c| res && (c == '4' || c == '7'));
    println!("{}", if ret { "YES" } else { "NO" });
}


use std::io::{Read,stdin};

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

    let n = get!(usize);
    let s = get().as_bytes();

    let mut i = 0;
    let mut c = 1;
    let mut ans = vec![];
    while i < n {
        ans.push(s[i]);
        i += c;
        c += 1;
    }
    println!("{}", String::from_utf8(ans).unwrap());

 }


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

fn main() {
	let mut rin = reader();
	let mut rout = writer();

	let n = rin.u();
	let a = rin.vi(n);
	let mut aa = v!([n]);
	for i in 0..n {
		aa.push( (a[i],i) );
	}
	aa.sort();
	let mut bb = v!([n] = 0);
	for i in 0..n {
		bb[aa[i].1] = a[aa[(i+1)%n].1];
	}
	for i in 0..n {
		write!(rout, "{} ", bb[i]).ok();
	}
}


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

    let mut it = input.split_whitespace();

    let n: u32 = it.next().unwrap().parse().unwrap();
    let s: u32 = it.next().unwrap().parse().unwrap();

    let ans = (s - 1) / n + 1;

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


use std::io::Read;

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

    for number in &vec[1] {
        for digit in &vec[2] {
            if digit == number {
                print!("{} ", &digit);
            }
        }
    }

    println!("");
}


use std::io;

fn zeros_fac(n : u32) -> u32 {
    let mut i = 5;
    let mut count = 0;
    while i <= n {
        count += n / i;
        i *= 5;
    }
    count
}

fn bsearch(mut pi : u32, mut pf : u32, n : u32) -> Option<u32> {
    while pf >= pi {
        let pm = (pf + pi) / 2;
        let zeros_pm = zeros_fac(5 * pm);
        if zeros_pm < n {
            pi = pm + 1;
        } else if zeros_pm == n {
            return Some(5 * pm);
        } else {
            pf = pm - 1;
        }
    }
    return None;
}

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

    match bsearch(4 * n / 5, n, n) {
        Some(x) => {
            println!("5");
            println!("{} {} {} {} {}", x, x + 1, x + 2, x + 3, x + 4);
        },
        None => println!("0"),
    };
}


use std::io;

fn main() {
    let (n, k): (u64, u64) = {
        let mut buffer = String::new();
        io::stdin().read_line(&mut buffer).unwrap();
        let mut iter = buffer.split_whitespace().map(|x| x.parse().unwrap());
        (iter.next().unwrap(), iter.next().unwrap())
    };
    let d = n/(2*k+2);
    println!("{} {} {}", d, d*k, n-d*(k+1));
}


fn main() {
    let (n, l): (usize, i64) = readln();
    let c: Vec<i64> = readln();

    let mut rest: i64 = l;
    let mut answer = i64::max_value();
    let mut used: i64 = 0;
    while rest > 0 {
        let over_cost = (0..n).filter(|x| rest <= (1i64 << x)).map(|x| c[x]).min();
        if let Some(over_cost) = over_cost {
            answer = min(answer, used + over_cost);
        }
        let last_idx = (0..n).filter(|x| rest >= (1i64 << x)).last().unwrap();
        let cost = (0..last_idx + 1)
            .map(|x| (1i64 << (last_idx - x)) * c[x])
            .min()
            .unwrap();
        let last_pow = (0..36).filter(|x| rest >= (1i64 << x)).last().unwrap();
        used += cost * 1i64 << (last_pow - last_idx);
        rest -= 1i64 << last_pow;
    }
    answer = min(answer, used);
    println!("{}", answer);
}

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

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


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

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

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

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

    let sol = input.i().min(input.i()/2).min(input.i()/4) * 7;
    println!("{}", sol);
}


//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, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

fn enumerate(a: &[u32], m: u32) -> Vec<u32> {
    let mut ans = vec![0];
    for &a in a.iter() {
        let mut next = ans.clone();
        for v in ans {
            next.push((v + a) % m);
        }
        ans = next;
    }
    ans.sort();
    ans.dedup();
    ans
}

fn run() {
    input! {
        n: usize,
        m: u32,
        a: [u32; n],
    }
    let mid = n / 2;
    let (l, r) = a.split_at(mid);
    let l = enumerate(l, m);
    let r = enumerate(r, m);
    let mut ans = (*l.last().unwrap() + *r.last().unwrap()) % m;
    let mut j = 0;
    for l in l.iter().rev() {
        while j + 1 < r.len() && *l + r[j + 1] < m {
            j += 1;
        }
        ans = std::cmp::max(ans, (*l + r[j]) % m);
    }
    println!("{}", ans);
}

fn main() {
    run();
}


#[allow(unused_imports)] use std::{*, io::*, };
#[allow(unused)] macro_rules! input { ($($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)] macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
#[allow(unused)] 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:tt ]) => {{ let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}
#[allow(unused)] macro_rules! debug { ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap()); }
#[allow(unused)] macro_rules! debugln { ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap()); }

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    #[allow(unused)] macro_rules! puts { ($($format:tt)*) => (let _ = write!(out,$($format)*);); }
    input!{
        a: (i64, i64),
        b: (i64, i64),
        c: (i64, i64),
    }
    puts!(
        "{}",
        if (a.0 - b.0).pow(2) + (a.1 - b.1).pow(2) == (b.0 - c.0).pow(2) + (b.1 - c.1).pow(2)
        && (b.0 - a.0) * (c.1 - b.1) != (b.1 - a.1) * (c.0 - b.0)
        {"Yes"} else {"No"}
    );
}

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

#[allow(dead_code)]
fn get_word() -> String {
      let stdin = std::io::stdin();
      let mut stdin=stdin.lock();
      let mut u8b: [u8; 1] = [0];
      loop {
          let mut buf: Vec<u8> = Vec::with_capacity(16);
          loop {
              let res = stdin.read(&mut u8b);
              if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                  break;
              } else {
                  buf.push(u8b[0]);
              }
          }
          if buf.len() >= 1 {
              let ret = String::from_utf8(buf).unwrap();
              return ret;
          }
      }
}
#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8


// 992C
use std::io;

fn main() {
    let (mut x, k) = read_2::<u64>(&io::stdin());
    let modulo = 1000000007;
    if x == 0 {
        println!("{}", x);
        return;
    }
    x = x % modulo;
    let a = (mod_exp(2, k + 1, modulo) * x) % modulo;
    let b = mod_exp(2, k, modulo);
    if a >= b {
        println!("{}", (a - b + 1) % modulo);
    } else {
        println!("{}", ((modulo + a) - b + 1) % modulo);
    }
}

fn mod_exp(mut a: u64, mut k: u64, n: u64) -> u64 {
    let mut multiplier = 1;
    a = a % n;
    while k != 0 {
        if k % 2 == 1 {
            multiplier = (multiplier * a) % n;
        }
        a = (a * a) % n;
        k = k / 2;
    }
    multiplier
}

fn read_2<T>(stdin: &io::Stdin) -> (T, T)
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin.read_line(&mut s).unwrap();
    let mut iter = s.trim().split_whitespace().map(|x| x.parse().unwrap());
    (iter.next().unwrap(), iter.next().unwrap())
}


#[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 gcd(a: i64, b: i64) -> i64 {
  if a > b {
    return gcd(b,a);
  }
  if a == 0 {
    return 0;
  } else {
    return (b/a) + gcd(b%a,a);
  }
}

fn main() {
  let (a,b) = readln!(i64,i64);
  let res = gcd(a,b);
  println!("{}",res);
}


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

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

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

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

    let n = input.u();
    let mut k = input.i();
    let mut a = input.vi(n).into_iter().enumerate().map(|(a,b)| (b,a as i32+1)).collect::<Vec<_>>();
    a.sort();
    let mut sol = Vec::new();
    for (x,i) in a {
        if k >= x {
            k -= x;
            sol.push(i);
        } else {
            break;
        }
    }
    println!("{}", sol.len());
    for i in sol {
        print!("{} ", i);
    }
}


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

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

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

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

    let _ = input.i();
    let x = vec![7,5,3,2];
    let mut a = vec![0; 4];
    for c in input.bs() {
        for mut z in 2..(c - b'0' + 1) as i32 {
            for j in 0..4 {
                while z % x[j] == 0 {
                    z /= x[j];
                    a[j] += 1;
                }
            }
        }
    }
    for i in 0..4 {
        let n = a[i];
        for _ in 0..n { print!("{}", x[i]); }
        for mut z in 2..x[i] + 1 {
            for j in 0..4 {
                while z % x[j] == 0 {
                    z /= x[j];
                    a[j] -= n;
                }
            }
        }
    }
}


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

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

const MOD: i64 = 1_000_000_007;

/// Refers external ::MOD.
/// Verified by: https://beta.atcoder.jp/contests/arc099/submissions/2893648
mod mod_int {
    use ::MOD;
    use std::ops::*;
    #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
    pub struct ModInt { pub x: i64 }
    impl ModInt {
        fn check_integrity(self) {
            debug_assert!(self.x >= 0);
            debug_assert!(self.x < MOD);
        }
        // x >= 0
        pub fn new(x: i64) -> Self { ModInt { x: x % MOD } }
        #[allow(dead_code)]
        pub fn mul_fast(self, other: Self) -> Self {
            self.check_integrity();
            other.check_integrity();
            ModInt { x: self.x * other.x % MOD }
        }
        #[allow(dead_code)]
        pub fn mul_slow(self, other: Self) -> Self {
            // Naive multiplication in order to avoid overflow
            self.check_integrity();
            other.check_integrity();
            let mut sum = ModInt::new(0);
            let mut cur = self;
            let mut e = other.x;
            if self.x < other.x {
                cur = other;
                e = self.x;
            }
            while e > 0 {
                if e % 2 == 1 {
                    sum = sum + cur;
                }
                cur = cur + cur;
                e /= 2;
            }
            sum
        }
        pub fn pow(self, mut e: i64) -> Self {
            self.check_integrity();
            debug_assert!(e >= 0);
            let mut sum = ModInt::new(1);
            let mut cur = ModInt::new(self.x);
            while e > 0 {
                if e % 2 != 0 {
                    sum = sum * cur;
                }
                cur = cur * cur;
                e /= 2;
            }
            sum
        }
        pub fn inv(self) -> Self { self.pow(MOD - 2) }
    }
    impl Add for ModInt {
        type Output = Self;
        fn add(self, other: Self) -> Self {
            self.check_integrity();
            other.check_integrity();
            let mut sum = self.x + other.x;
            if sum >= MOD { sum -= MOD; }
            ModInt { x: sum }
        }
    }
    impl Sub for ModInt {
        type Output = Self;
        fn sub(self, other: Self) -> Self {
            self.check_integrity();
            other.check_integrity();
            let mut sum = self.x - other.x;
            if sum < 0 { sum += MOD; }
            ModInt { x: sum }
        }
    }
    impl Mul for ModInt {
        type Output = Self;
        fn mul(self, other: Self) -> Self {
            self.mul_fast(other)
        }
    }
    impl ::std::fmt::Display for ModInt {
        fn fmt(&self, f: &mut::std::fmt::Formatter) -> ::std::fmt::Result {
            self.x.fmt(f)
        }
    }
} // mod mod_int

use mod_int::*;

fn solve() {
    let n: usize = get();
    let s: Vec<char> = get_word().chars().collect();
    let m = s.len();
    let mut rev = vec![vec![0; m + 1]; 2];
    for i in 0 .. m {
        let idx = if s[i] == '(' { 0 } else { 1 };
        let opp = if s[i] == '(' { ')' } else { '(' };
        let mut grow = s[0 .. i].to_vec();
        grow.push(opp);
        let mut aa = 0;
        for j in 0 .. i + 1 {
            if grow[j ..] == s[.. i + 1 - j] {
                aa = i + 1 - j;
                break;
            }
        }
        rev[1 - idx][i] = aa;
        rev[idx][i] = i + 1;
    }
    rev[0][m] = m;
    rev[1][m] = m;
    let mut dp = vec![vec![vec![ModInt::new(0); m + 1]; n + 1]; 2 * n + 1];
    dp[0][0][0] = ModInt::new(1);
    for i in 0 .. 2 * n {
        for j in 0 .. n + 1 {
            for k in 0 .. m + 1 {
                if j < n {
                    dp[i + 1][j + 1][rev[0][k]] =
                        dp[i + 1][j + 1][rev[0][k]] + dp[i][j][k];
                }
                if j > 0 {
                    dp[i + 1][j - 1][rev[1][k]] =
                        dp[i + 1][j - 1][rev[1][k]] + dp[i][j][k];
                }
            }
        }
    }
    println!("{}", dp[2 * n][0][m]);
}

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


use std::io;
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 x1: i32 = scan.token();
    let y1: i32 = scan.token();
    let x2: i32 = scan.token();
    let y2: i32 = scan.token();
    let x: i32 = scan.token();
    let y: i32 = scan.token();
    let dx = (x2 - x1).abs();
    let dy = (y2 - y1).abs();
    if dx % (2 * x) == 0 && dy % (2 * y) == 0 {
        writeln!(out, "YES").ok();
    } else if dx % (2 * x) == x && dy % (2 * y) == y {
        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);
}


fn main() {
    let mut input: String = String::new();
    std::io::stdin().read_line(&mut input).expect("INPUT::read line failed");
    let amount = input.trim().parse::<i32>().unwrap();

    input.clear();
    std::io::stdin().read_line(&mut input).expect("INPUT::read line failed");
    let vec:Vec<char> = input.trim().chars().collect::<Vec<char>>();
    let mut crossword: Vec<i32> = vec![];
    let mut max_len = i32::default();

    for _item in &vec {
        match _item {
            'B' => max_len += 1,
            'W' => {
                if max_len > 0 {
                    crossword.push(max_len);
                    max_len = 0;
                }
            },
            _ => println!("ERROR::letter not exist")
        }

    }

    if max_len > 0 {
        crossword.push(max_len);
        max_len = 0;
    }

    match crossword.len() {
        0 => println!("0"),
        _ => {
            println!("{}", crossword.len());
            for _item in &crossword {
                print!("{} ", _item);
            }
        }
    }

    //println!("{:?}", vec);
    //println!("{:?}", crossword);
}


mod util {
    use std;
    pub fn read_line() -> String {
        let mut buffer = String::new();
        std::io::stdin().read_line(&mut buffer).unwrap();
        String::from(buffer.trim_right())
    }
    #[allow(dead_code)]
    pub fn read_ascii() -> Vec<u8> {
        let line = read_line();
        debug_assert!(line.is_ascii());
        line.bytes().collect()
    }
    #[allow(dead_code)]
    pub fn read1() -> i64 {
        read_line().parse::<i64>().unwrap()
    }
    #[allow(dead_code)]
    fn read_nums<T: std::str::FromStr>() -> Vec<T>
        where <T as std::str::FromStr>::Err : std::fmt::Debug {
        read_line().split(' ').map(|x| x.parse::<T>().unwrap()).collect()
    }
    #[allow(dead_code)]
    pub fn read_ints() -> Vec<i64> {
        read_nums::<i64>()
    }
    #[allow(dead_code)]
    pub fn read_floats() -> Vec<f64> {
        read_nums::<f64>()
    }
    #[allow(dead_code)]
    pub fn read2() -> (i64, i64) {
        let nums = read_ints();
        (nums[0], nums[1])
    }
    #[allow(dead_code)]
    pub fn read3() -> (i64, i64, i64) {
        let nums = read_ints();
        (nums[0], nums[1], nums[2])
    }
    #[allow(dead_code)]
    pub fn read4() -> (i64, i64, i64, i64) {
        let nums = read_ints();
        (nums[0], nums[1], nums[2], nums[3])
    }
} // mod util
use util::*;

type Prime = i64;
type Power = usize;
type PrimePower = (Prime, Power);
type Factorization = Vec<PrimePower>;

fn primes_below(maxn: usize) -> Vec<Prime> {
    if maxn <= 2 {
        return vec![];
    }
    let mut is_prime: Vec<bool> = vec![true; maxn];
    is_prime[0] = false;
    is_prime[1] = false;
    let mut iterator: i64 = 2;
    while iterator * iterator < maxn as i64 {
        if is_prime[iterator as usize] {
            let mut destroyer: i64 = iterator * iterator;
            while destroyer < maxn as i64 {
                is_prime[destroyer as usize] = false;
                destroyer += iterator;
            }
        }
        iterator += 1;
    }
    is_prime.iter().enumerate().filter(|pair| *pair.1)
        .map(|pair| pair.0 as Prime).collect()
}

fn naive_factorization(mut number: i64, primes_till_sqrt: &Vec<Prime>) -> Factorization {
    let mut prime_iter: usize = 0;
    let mut prime: Prime;
    let mut answer: Factorization = vec![];
    while number != 1 {
        if prime_iter >= primes_till_sqrt.len() {
            answer.push((number, 1));
            return answer;
        }
        prime = primes_till_sqrt[prime_iter];
        if number % prime == 0 {
            let mut power: Power = 0;
            while number % prime == 0 {
                power += 1;
                number /= prime;
            }
            answer.push((prime, power));
        }
        prime_iter += 1;
    }
    answer
}

fn main() {
    let b = read1();
    let v = primes_below(100000);
    let mut ans = 1;
    for (_p, val) in naive_factorization(b, &v) {
        ans *= (val + 1);
    }
    println!("{}", ans);
}


// Vicfred
// https://codeforces.com/problemset/problem/546/C

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

#[derive(Debug,PartialEq,Eq,PartialOrd,Ord,Hash)]
struct Pair(i64, i64);

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

    io::stdin()
        .read_line(&mut n)
        .unwrap();

    let mut line = String::new();

    io::stdin()
        .read_line(&mut line)
        .unwrap();

    let mut a: VecDeque<i64> =
        line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    a.pop_front();

    let mut line = String::new();

    io::stdin()
        .read_line(&mut line)
        .unwrap();

    let mut b: VecDeque<i64> =
        line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    b.pop_front();

    let mut ans = 0;

    while !a.is_empty() && !b.is_empty() {
        ans += 1;

        let x = a.pop_front().unwrap();
        let y = b.pop_front().unwrap();

        if x > y {
            a.push_back(y);
            a.push_back(x);
        } else {
            b.push_back(x);
            b.push_back(y);
        }
        if ans > 1000 {
            println!("-1");
            return;
        }
    }

    let winner = if a.is_empty() {2} else {1};

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


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

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let n: i32 = input.trim().parse().unwrap();
    let mut segs: Vec<(i32, i32, i32)> = vec![];

    for i in 0..(n+1) {
        for j in (i+1)..(n+1) {
            segs.push((j-i,i,j));
        }
    }
    segs.sort();
    let mut result: i32 = 0;
    let mut flags: Vec<bool> = vec![false; segs.len()];
    for i in (0..segs.len()).rev() {
        if flags[i] { continue; }
        let (size, mut a, mut b) = segs[i];
        flags[i] = true;
        let mut cur: i32 = size;
        while cur < n {
            let mut did_something = false;
            for j in (0..segs.len()).rev() {
                if flags[j] { continue; }
                let (s, c, d) = segs[j];
                if a == d || b == c {
                    if cur + s <= n {
                        a = cmp::min(a, c);
                        b = cmp::max(b, d);
                        cur += s;
                        flags[j] = true;
                        did_something = true;
                    }
                }
            }
            if !did_something { break; }
        }
        result += 1;
    }
    println!("{}", result);
}


// use std::ops::{Index, IndexMut};
use std::cmp::{Ordering, min, max};
// use std::collections::{BinaryHeap, BTreeMap};
// use std::collections::btree_map::Entry::{Occupied, Vacant};
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! split {
    ($x: expr) => {
        ($x).trim().split(' ').collect()
    }
}

macro_rules! parse {
    ($x: expr) => {
        ($x).parse().unwrap()
    }
}

macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            let iv: Vec<_> = split!(s);
            let mut iter = iv.into_iter();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let iv: Vec<_> = split!(s);
            let mut iter = iv.into_iter();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

macro_rules! rvec {
    ($x: expr) => {
        ($x).into_iter().map(|x| parse!(x)).collect()
    }
}

macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iv: Vec<_> = split!(s);
            iv.into_iter().map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {}", stringify!($x), $x)
    }
}

fn printvec<T>(v: &Vec<T>) where T: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}

fn main() {
    let (n, k) = readl!(usize, i64);
    let a = readlvec!(i64);

    let ma = a.iter().fold(0,|acc, &x| max(acc,x));
    let bo = (ma as f64).sqrt() as i64 + 2;
    let mut ans = 1;
    for i in 1..bo {
        let mut sum = 0;
        for e in &a {
            sum += (i-e%i)%i;
        }
        if sum <= k {
            ans = i;
        }
    }

    let mut qu = Vec::<(i64,usize)>::new();
    qu.push((bo,0));
    for i in 0..n {
        for j in 1..bo {
            if a[i]/j != 0 && bo <= a[i]/j {
                qu.push(((a[i]+j-1)/j,i));
            }
        }
    }
    qu.sort();
    let mut qui = qu.into_iter();
    let mut b = vec![0;n];
    let mut pre = -100;
    if let Some((di,i)) = qui.next() {
        for i in 0..n {
            b[i] = (a[i]+di-1)/di;
        }
        pre = di;
    }
    let mut sb = b.iter().fold(0,|acc, &x| acc+x);
    let sa = a.iter().fold(0,|acc, &x| acc+x);
    for (di, i) in qui {
        if pre*sb-sa <= k {
            let m = (k+sa-pre*sb)/sb;
            if pre+m < di {
                ans = pre+m;
            }
        }
        sb -= b[i];
        b[i] = (a[i]+di-1)/di;
        sb += b[i];
        pre = di;
    }
    if pre*sb-sa <= k {
        let m = (k+sa-pre*sb)/sb;
        ans = pre+m;
    }

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


use std::io;
use std::io::Read;

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

    let n = get!(u64);
    let m = get!(u64);

    if n > 63 {
        println!("{}", m);
    } else {
        let x = (1 << n) - 1;
        println!("{}", m & x);
    }

}


#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::{Ordering::*, Reverse};
use std::collections::{BTreeMap, BTreeSet, VecDeque, BinaryHeap};
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 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 _n: usize = scan.token();
    let s: Vec<u8> = scan.token::<String>().bytes().map(|b| b - b'0').map(|x| x as u8).collect();
    let t: Vec<u8> = s.iter().scan(1, |cin, &x| {
        let y = (x + *cin) & 1;
        *cin = (x + *cin) >> 1;
        Some(y)
    }).collect();
    answer!(out, s.into_iter().zip(t.into_iter()).filter(|(x, y)| x != y).count())
}

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

/// Mostly 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 [Scanner]");
            }
            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())
    }
}

// aka #![feature(bool_to_option)]
trait BoolThen {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T>;
}

impl BoolThen for bool {
    fn then_<T>(self, f: impl FnOnce() -> T) -> Option<T> {
        if self {
            Some(f())
        } else {
            None
        }
    }
}

trait BoolToYes {
    fn yes(self) -> &'static str;
}

impl BoolToYes for bool {
    fn yes(self) -> &'static str {
        match self {
            true => "Yes",
            false => "No",
        }
    }
}


// @robertkingnz https://twitter.com/robertkingNZ

/// Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools

/// To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other

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

fn main() -> io::Result<()> {
    let mut s = String::new();
    io::stdin().read_to_string(&mut s)?;
    let mut it = s
        .split_whitespace()
        .map(|s| s.to_string());
    let mut out = String::new();
    let n: i32 = it.next().unwrap().parse().unwrap();
    let p: f64 = it.next().unwrap().parse().unwrap();
    for x in 0..=n {
        let x = x as f64;
        let n = n as f64;
        let c0 = (n-x)/n * (n-x-1.0)/(n-1.0) * (n-x-2.0)/(n-2.0);
        let c1 = x/n * (n-x)/(n-1.0) * (n-x-1.0)/(n-2.0) +
            (n-x)/n * x/(n-1.0) * (n-x-1.0)/(n-2.0) +
            (n-x)/n * (n-x-1.0)/(n-1.0) * x/(n-2.0);
        let c3 = x/n * (x-1.0)/(n-1.0) * (x-2.0)/(n-2.0);
        let c2 = 1.0 - c0 - c1 - c3;
        // println!("{} {} {} {} {}", x, c0, c1, c2, c3);
        let y = c1/2.0 + c2 + c3;
        // println!("{} {} {} {}", x, c1, c2, c3);
        if y >= p-0.00000001 {
            let ans = format!("{}\n", x);
            out.push_str(ans.as_str());
            print!("{}", out);
            break;
        }
    }
    Ok(())
}

/*
n maps
P(x) >= p

c0*p0 + c1*p1 +.. +c3*p3 > p

c(i) = choose(n, i)/choose(n, 3)
p(i) =
if i = 3 -> 1.0
if i = 2 -> 1.0
if i = 1 -> 1/3 * ( same_bad = 1/2 + other_bad = 1 + only_good = 0  ) = 1/3 * 3/2  = 1/2
if i = 0 -> 0

c0*0+ c1/2 + c2*1 + c3*2
= c1/2 + c2 + c3

n choose 3 = n*(n-1)*(n-2)
x choose 1 = x
x choose 2 = x*(x-1)
x choose 3 = x*(x-1)*(x-3)

7:
p(1) = 1/2
c(1) = 1/2
1/4

1/7
6/7 (
1/6
5/6 (
1/5
0
)
)

1/7 + 6/7*(1/6+5/6*(1/5)) = 3/7 = 0.42867
 */


use std::io;
use std::str::FromStr;
use std::collections::HashMap;

fn get_num() -> usize{
    let mut input = String::new();

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

    usize::from_str(input.trim()).unwrap()
}

fn main() {
    let n = get_num();

    let mut m = HashMap::new();
    m.insert(0, (0, 0));
    m.insert(1, (0, 1));
    m.insert(2, (0, 2));
    m.insert(3, (0, 2));
    m.insert(4, (0, 2));
    m.insert(5, (0, 2));
    m.insert(6, (1, 2));
    m.insert(7, (2, 2));

    if n < 8 {
        let r = m.get(&n).unwrap();
        println!("{} {}", r.0, r.1);
    } else {
        let r = m.get(&(n%7)).unwrap();
        println!("{} {}", (n/7) * 2 + r.0, (n/7) * 2 + r.1);
    }
}


mod max_flow {
    use std;
    type F = i32;
    pub const INF: F = 1000;
    const ZERO: F = 0;
    fn non_zero(f: F) -> bool {
        f > ZERO
    }
    fn min(a: F, b: F) -> F {
        if a < b {
            a
        } else {
            b
        }
    }
    pub struct Graph {
        n: usize,
        depth: Vec<usize>,
        it: Vec<usize>,
        g: Vec<Vec<(usize, F, usize)>>,
    }
    impl Graph {
        pub fn new(n: usize) -> Graph {
            Graph {
                n: n,
                depth: vec![n + 1; n],
                it: vec![0; n],
                g: vec![vec![]; n],
            }
        }
        pub fn add_edge(&mut self, s: usize, t: usize, f: F) {
            let x = self.g[s].len();
            let y = self.g[t].len();
            self.g[s].push((t, f, y));
            self.g[t].push((s, ZERO, x));
        }
        fn bfs(&mut self, src: usize, dst: usize) {
            let g = &self.g;
            let n = self.n;
            let dp = &mut self.depth;
            dp.clear();
            dp.resize(n, n + 1);
            dp[src] = 0;
            let mut q = std::collections::VecDeque::new();
            q.push_back(src);
            'outer: while let Some(v) = q.pop_front() {
                for &(u, f, _) in g[v].iter() {
                    if dp[u] > dp[v] + 1 && non_zero(f) {
                        dp[u] = dp[v] + 1;
                        if u == dst {
                            break 'outer;
                        }
                        q.push_back(u);
                    }
                }
            }
        }
        fn dfs(&mut self, v: usize, src: usize, f: F) -> F {
            if v == src {
                return f;
            }
            while self.it[v] < self.g[v].len() {
                let (u, _, inv) = self.g[v][self.it[v]];
                if self.depth[u] < self.depth[v] && non_zero(self.g[u][inv].1) {
                    let capa = min(f, self.g[u][inv].1);
                    let c = self.dfs(u, src, capa);
                    if non_zero(c) {
                        self.g[v][self.it[v]].1 += c;
                        self.g[u][inv].1 -= c;
                        return c;
                    }
                }
                self.it[v] += 1;
            }
            ZERO
        }
        pub fn flow(&mut self, src: usize, dst: usize) -> F {
            let mut ans = ZERO;
            loop {
                self.bfs(src, dst);
                if self.depth[dst] > self.n {
                    break;
                }
                self.it.clear();
                self.it.resize(self.n, 0);
                loop {
                    let f = self.dfs(dst, src, INF);
                    if non_zero(f) {
                        ans += f;
                    } else {
                        break;
                    }
                }
            }
            ans
        }
    }
}

fn diff(a: usize, b: usize) -> usize {
    std::cmp::max(a, b) - std::cmp::min(a, b)
}

#[allow(dead_code)]
fn test() {
    let n = 25;
    for h in 1..=n {
        print!("{:>2}: ", h);
        for w in 1..=n {
            let mut g = max_flow::Graph::new(h * w + 2);
            let src = h * w + 1;
            let dst = src - 1;
            for i in 0..h {
                for j in 0..w {
                    if (i + j) & 1 == 0 {
                        g.add_edge(src, i * w + j, 1);
                        for k in 0..h {
                            for l in 0..w {
                                if diff(i, k) + diff(j, l) == 3 {
                                    g.add_edge(i * w + j, k * w + l, 1);
                                }
                            }
                        }
                    } else {
                        g.add_edge(i * w + j, dst, 1);
                    }
                }
            }
            let ans = g.flow(src, dst) * 2;
            let c = if ans as usize == h * w { ' ' } else { '!' };
            print!("{:>4}{}", ans, c);
        }
        println!();
    }
}

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let mut h: usize = it.next().unwrap().parse().unwrap();
    let mut w: usize = it.next().unwrap().parse().unwrap();
    if h > w {
        std::mem::swap(&mut h, &mut w);
    }
    if h * w <= 100 {
        let mut g = max_flow::Graph::new(h * w + 2);
        let src = h * w + 1;
        let dst = src - 1;
        for i in 0..h {
            for j in 0..w {
                if (i + j) & 1 == 0 {
                    g.add_edge(src, i * w + j, 1);
                    for k in 0..h {
                        for l in 0..w {
                            if diff(i, k) + diff(j, l) == 3 {
                                g.add_edge(i * w + j, k * w + l, 1);
                            }
                        }
                    }
                } else {
                    g.add_edge(i * w + j, dst, 1);
                }
            }
        }
        let ans = g.flow(src, dst) * 2;
        println!("{}", ans);
    } else if h == 1 {
        let mut ans = w / 6 * 6;
        if w % 6 >= 4 {
            ans += 2;
        }
        if w % 6 >= 5 {
            ans += 2;
        }
        println!("{}", ans);
    } else if h % 2 == 1 && w % 2 == 1 {
        let ans = h as u64 * w as u64 - 1;
        println!("{}", ans);
    } else {
        let ans = h as u64 * w as u64;
        println!("{}", ans);
    }
}

fn main() {
//    test();
    run();
}


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

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

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

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

    println!("{}", (input.i() - 1) / 2);
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, k: i64,
        s: chars,
    }
    let s: Vec<_> = s.into_iter().map(|c| c as usize - 97).collect();
    let mut dp = vec![vec![0i64; n + 1]; n + 1];
    let mut nxt = vec![[n; 26]; n + 1];
    for i in (0..n).rev() {
        nxt[i] = nxt[i + 1];
        nxt[i][s[i]] = i;
    }
    dp[n][0] = 1;
    for i in (0..n).rev() {
        dp[i][0] = dp[i][0].saturating_add(1);
        for j in 0..n {
            let mut tot: i64 = 0;
            for l in 0..26 {
                let to = nxt[i][l] + 1;
                if to <= n {
                    tot = tot.saturating_add(dp[to][j]);
                }
            }
            dp[i][j + 1] = dp[i][j + 1].saturating_add(tot);
        }
    }
    let mut cost = 0;
    let mut rem = k;
    for i in (0..n + 1).rev() {
        let now = min(dp[0][i], rem);
        cost += now * (n - i) as i64;
        rem -= now;
        if rem <= 0 {
            break;
        }
    }
    puts!("{}\n", if rem > 0 { -1 } else { cost });
}

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


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 gcd(mut a: usize, mut b: usize) -> usize {
    if b > a {
        std::mem::swap(&mut a, &mut b);
    }
    while b != 0 {
        let new_b = a % b;
        a = b;
        b = new_b;
    }
    if a == 0 {
        1
    } else {
        a
    }
}

fn _main() {
    let mut scan = Scan::new();
    let a: usize = scan.next();
    let b: usize = scan.next();
    let x = 6 - a.max(b) + 1;
    let common = gcd(x, 6);
    println!("{}/{}", x / common, 6 / common);
}

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


#![allow(non_snake_case)]
use std::io::{BufWriter, stdin, stdout, Write};

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());
    let t: usize = scan.next();
    for _ in 0..t {
        let a1: Vec<usize> = (0..2).map(|_| scan.next()).collect();
        let a2: Vec<usize> = (0..2).map(|_| scan.next()).collect();
        let s = a1.iter().sum::<usize>() + a2.iter().sum::<usize>();
        if s == 0 {
            writeln!(out, "0").unwrap();
        } else if s == 1 {
            writeln!(out, "1").unwrap();
        } else if s == 2 {
            if a1 == vec![1, 1] || a2 == vec![1, 1] {
                writeln!(out, "1").unwrap();
            } else {
                writeln!(out, "1").unwrap();
            }
        } else if s == 3 {
            writeln!(out, "1").unwrap();
        } else {
            writeln!(out, "2").unwrap();
        }
    }
}

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


// 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 {
        () => (get!(i64));
        ($t:ty) => (get().parse::<$t>().unwrap());
    }

    let n = get().as_bytes();

    let mut p = 0;
    let mut s = 0;
    for &c in n {
        if c == b'o' {
            p += 1;
        } else {
            s += 1;
        }
    }

    if p < 2 || s == 0 {
        println!("YES");
        return;
    }

    if s % p == 0 {
        println!("YES");
    } else {
        println!("NO");
    }

}


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

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

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

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

    let s = input.bs();
    let n = s.len();
    let x = (0..n).zip((0..n).rev()).filter(|(a,b)| a < b && s[*a] != s[*b]).count();
    if (n % 2 == 1 && x <= 1) || (n % 2 == 0 && x == 1) {
        println!("YES");
    } else {
        println!("NO");
    }
}


mod solution {
  use std::io::{self, Write, BufRead};

  pub fn solve() {
    let stdin = io::stdin();
    let mut iterator = stdin.lock().lines();
    iterator.next(); // Throw away first input
    let nums: Vec<i32> = iterator.next().unwrap().unwrap()
      .split(" ")
      .into_iter()
      .map(|str_num| {
        let num: i32 = str_num.trim().parse().unwrap();
        num.abs() // Absolute value b/c -(-) -> (+)
      })
      .collect();
    let result: i32 = nums.iter().sum();
    io::stdout().write(&result.to_string().as_bytes()).unwrap();
  }
}

fn main() {
  solution::solve();
}


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

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

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

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

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n = scan.token::<u32>();
    let mut top = 0;
    let mut bottom = 0;
    let mut flippable = false;
    for _ in 0..n {
        let t = scan.token::<u32>();
        let b = scan.token::<u32>();
        if t % 2 != b % 2 { flippable = true; }
        top += t;
        bottom += b;
    }
    let ans = {
        if top % 2 != 0 && bottom % 2 != 0 && flippable {1}
        else if top % 2 == 0 && bottom % 2 == 0 { 0 }
        else { -1 }
    };
    writeln!(out, "{}", ans);
}

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


//spnauti-rusT
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 n = input.i();
    input.sk(1);
    if input.bs()[0] == b'm' {
        println!("{}", if n <= 29 {12} else if n <= 30 {11} else {7});
    } else {
        println!("{}", if n == 5 || n == 6 {53} else {52});
    }
}


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

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

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

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

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

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

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

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

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

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

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

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

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


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

type Grid = Vec<Vec<usize>>;

fn valid_index(index: isize) -> bool {
    index >= 0 && index <= 2
}

fn get_position(grid: &Grid, x: isize, y: isize) -> usize {
    if !valid_index(x) || !valid_index(y) {
        0
    } else {
        *grid.get(y as usize).and_then(|n| n.get(x as usize).or(Some(&0))).unwrap_or(&0)
    }
}

fn main() {
    let numbers: Grid = io::stdin()
        .lock()
        .lines()
        .take(3)
        .map(|line| line.expect("failed to read line")
                .trim()
                .split(" ")
                .map(|number| number.parse::<usize>().expect("failed to parse number"))
                .collect()
            )
        .collect();

    for y in 0 as isize..3 {
        for x in 0 as isize..3 {
            let mut n = get_position(&numbers, x, y);
            n += get_position(&numbers, x, y - 1);
            n += get_position(&numbers, x, y + 1);
            n += get_position(&numbers, x - 1, y);
            n += get_position(&numbers, x + 1, y);
            print!("{}", match n % 2 {
                0 => 1,
                1 => 0,
                _ => unreachable!()
            });
        }
        println!("");
    }
}


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

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

fn solve() {
    let n: usize = get();
    let a: Vec<i32> = (0 .. n).map(|_| get()).collect();
    let mut ma = 0;
    for i in 0 .. (n + 1) {
        let mut tmp = 0;
        for j in 0 .. i {
            tmp += 1 - a[j];
        }
        for j in i .. n {
            tmp += a[j];
        }
        ma = max(ma, tmp);
    }
    println!("{}", ma);
}

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


use std::collections::HashSet;

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

    let name = buf.trim_end();
    let mut set: HashSet<char> = HashSet::new();

    for chr in name.chars() {
        set.insert(chr);
    }

    if set.len() % 2 == 0 {
        println!("CHAT WITH HER!");
    }
    else {
        println!("IGNORE HIM!");
    }
}


/// https://github.com/akiradeveloper/rust-comp-snippets

#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;

#[macro_export]
macro_rules! chmax {
    ($x:expr, $($v:expr),+) => {
        $(
            $x = std::cmp::max($x,$v);
        )+
    };
}

#[macro_export]
macro_rules! chmin {
    ($x:expr, $($v:expr),+) => {
        $(
            $x = std::cmp::min($x,$v);
        )+
    };
}

#[macro_export]
macro_rules! max {
    ($x:expr) => ( $x );
    ($x:expr, $($xs:expr),+) => {
        std::cmp::max($x, max!( $($xs),+ ))
    };
}

#[macro_export]
macro_rules! min {
    ($x:expr) => ( $x );
    ($x:expr, $($xs:expr),+) => {
        std::cmp::min($x, min!( $($xs),+ ))
    };
}

#[macro_export]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[macro_export]
macro_rules! cfor {
    // for (; ...; ...) { ... }
    (; $($rest: tt)*) => {
        cfor!((); $($rest)*)
    };
    // for ($init; ; ...) { ... }
    ($($init: stmt),+; ; $($rest: tt)*) => {
        // avoid the `while true` lint
        cfor!($($init),+; !false; $($rest)*)
    };

    // for ($init; $cond; ) { ... }
    ($($init: stmt),+; $cond: expr; ; $body: block) => {
        cfor!{$($init),+; $cond; (); $body}
    };

    // for ($init; $cond; $step) { $body }
    ($($init: stmt),+; $cond: expr; $($step: expr),+; $body: block) => {
        {
            $($init;)+
            while $cond {
                let mut _first = true;
                let mut _continue = false;
                // this loop runs once, allowing us to use `break` and
                // `continue` as `goto` to skip forward to the
                // condition.
                //
                // the booleans above are very transparent to the
                // optimiser, since they are modified exactly once,
                // with nice control flow, and this this optimises to
                // be similar to C for loop.
                loop {
                    // if we *don't* hit this, there was a `break` in
                    // the body (otherwise the loop fell-through or
                    // was `continue`d.)
                    if !_first { _continue = true; break }
                    _first = false;

                    $body
                }
                if !_continue {
                    // the `if` wasn't hit, so we should propagate the
                    // `break`.
                    break
                }

                $($step;)+
            }
        }
    };
}

/// main

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

// ref: tanakh <https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8>
// diff: using Parser
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut parser = Parser::from_str($s);
        input_inner!{parser, $($r)*}
    };
    (parser = $parser:ident, $($r:tt)*) => {
        input_inner!{$parser, $($r)*}
    };
    (new_stdin_parser = $parser:ident, $($r:tt)*) => {
        let stdin = std::io::stdin();
        let reader = std::io::BufReader::new(stdin.lock());
        let mut $parser = Parser::new(reader);
        input_inner!{$parser, $($r)*}
    };
    ($($r:tt)*) => {
        input!{new_stdin_parser = parser, $($r)*}
    };
}

#[macro_export]
macro_rules! input_inner {
    ($parser:ident) => {};
    ($parser:ident, ) => {};
    ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($parser, $t);
        input_inner!{$parser $($r)*}
    };
}

#[macro_export]
macro_rules! read_value {
    ($parser:ident, ( $($t:tt),* )) => {
        ( $(read_value!($parser, $t)),* )
    };
    ($parser:ident, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($parser, $t)).collect::<Vec<_>>()
    };
    ($parser:ident, chars) => {
        read_value!($parser, String).chars().collect::<Vec<char>>()
    };
    ($parser:ident, usize1) => {
        read_value!($parser, usize) - 1
    };
    ($parser:ident, $t:ty) => {
        $parser.next::<$t>().expect("Parse error")
    };
}

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

// ref: tatsuya6502 <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e>
// ref: wariuni <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e#comment-7040a5ae96305e884eb9>
// diff: using std::io::BufRead::fill_buf()
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}

impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}

impl<R:BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len,complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                // diff: care when there is no empty space or line at the end
                if len == 0 {
                     break;
                }
                (len, buf2[len-1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T:str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return str::from_utf8(&self.buf[begin..end]).unwrap().parse::<T>();
            }
            else {
                self.update_buf();
            }
        }
    }
}

#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    input!{
        n:i64,m:i64,
    }
    let mi = max(0, n-2*m);
    let fullconn = n*(n-1)/2;
    let ma = if m==0 {
        n
    } else {
        let mut i=1;
        loop {
            if i*(i-1)/2 >= m {
                break;
            }
            i += 1;
        }
        n-i
    };
    writeln!(out,"{} {}", mi,ma);
}


use std::cmp;
use std::fs::File;
use std::io::Read;

// fn pow_speedt_with_mod(mut p: i64, mut q: i64, m: i64) -> i64 {
//     p %= m;
//     let mut r = p;
//     let mut ret: i64 = 1;
//     while q > 0 {
//         ret *= if q % 2 == 1 {r} else {1};
//         r *= r;
//         r %= m;
//         q /= 2;
//         ret %= m;
//     }
//     return ret;
// }

fn main() {
    let inputstatus = 1;

    let mut buf = String::new();
    let filename = "inputrust.txt";

    if inputstatus == 0 {
        let mut f = File::open(filename).expect("file not found");
        f.read_to_string(&mut buf)
            .expect("something went wrong reading the file");
    } else {
        std::io::stdin().read_to_string(&mut buf).unwrap();
    }

    let mut iter = buf.split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();

    let v: [i32; 3] = [a / 3, b / 2, c / 2];
    let week: i32 = *v.iter().min().unwrap() as i32;

    let fish: i32 = a - 3 * week;
    let rabbit: i32 = b - 2 * week;
    let chicken: i32 = c - 2 * week;
    let mut ans = 0;
    let menu: [usize; 7] = [0, 1, 2, 0, 2, 1, 0];

    for df in 0..7 {
        let mut rest: [i32; 3] = [fish, rabbit, chicken];
        for di in 0..7 {
            let d = menu[(df + di) % 7];
            rest[d] -= 1;
            if rest[d] < 0 {
                ans = cmp::max(ans, di as i32);
                break;
            }
        }
    }

    println!("{}", ans + week * 7);

    // println!("{}", n);

    // if p + 1 >= m

    // println!("{}", n);
    // println!("{}", k);
    // println!("{:?}", num);
    // println!("{:?}", cum_num);
}


// 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 {
        () => (get().parse::<i64>().unwrap());
        ($t:ty) => (get().parse::<$t>().unwrap());
    }

    let n = get!();
    let mut ans = 0;
    for a in 1..n+1 {
        for b in a..n+1 {
            let c = a ^ b;
            if c >= b && c <= n && a + b > c {
                // println!("{} {} {}", a, b, c);
                ans += 1;
            }
        }
    }

    println!("{}", ans);

}


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 triangle(a: i32, b: i32, c: i32) -> bool {
    (c - b < a && a < c + b) && (c - a < b && b < c + a) && (b - a < c && c < b + a)
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n: usize = scan.token();
    let mut lengths = Vec::new();
    for _ in 0..n {
        lengths.push(scan.token::<i32>());
    }
    lengths.sort();
    for i in 0..n - 2 {
        if triangle(lengths[i], lengths[i + 1], lengths[i + 2]) {
            writeln!(out, "YES").ok();
            return;
        }
    }
    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);
}


fn main() {
    let mut first_string = String::from("");
            std::io::stdin()
                    .read_line(&mut first_string)
                    .expect("String not found");

    let mut second_string = String::from("");
            std::io::stdin()
                    .read_line(&mut second_string)
                    .expect("String not found");

    // if first_string.len() > 100) || (second_string.len() > 100) {
    //     return()
    // }

    if first_string.len() != second_string.len() {
        return ()
    }

    let first_string = first_string.to_lowercase();
    let second_string = second_string.to_lowercase();

    // let comp1 = first_string.eq(&second_string);
    // let comp2 = second_string.eq(&first_string);

    if first_string == second_string { println!("0"); }

    else if first_string > second_string { println!("1"); }

    else if first_string < second_string { println!("-1"); }

    else { return () }

}


use std::io;
fn main() {
    let data = read();
    let mut ans = String::new();
    let mut count = 0;
    let mut lower = 0;
    for val in data.chars(){
        if count != 0 {
            if val.is_lowercase(){
                lower = 1;
            }
        }
        count += 1;
    }
    count = 0;
    if lower == 0 {
        for val in data.chars(){
            if count == 0 && val.is_lowercase(){
                let d : Vec<char> = val.to_uppercase().collect();
                ans.push(d[0]);
            }
            else if count == 0 && val.is_uppercase(){
                let d : Vec<char> = val.to_lowercase().collect();
                ans.push(d[0]);
            }
            else{
                let d : Vec<char> = val.to_lowercase().collect();
                ans.push(d[0]);
            }
            count += 1;
        }
    }
    else{
        ans = data;
    }
    println!("{}",ans);
}
fn read() -> String{
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    input.trim().parse::<String>().unwrap()
}