Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets:  1+2*3=7  1*(2+3)=5  1*2*3=6  (1+2)*3=9 Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2.It's easy to see that the maximum value that you can obtain is 9.Your task is: given a, b and c print the maximum value that you can get.

The input contains three integers a, b and c, each on a single line (1 ≤ a, b, c ≤ 10).

Print the maximum value of the expression that you can obtain.

#[allow(unused)] use std::io::*;
#[allow(unused)] use std::collections::*;
#[allow(unused)] use std::mem::*;
#[allow(unused)] use std::num::*;
#[allow(unused)] use std::cmp::*;
#[allow(unused)] macro_rules! scan { ($($x:ty), +) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0).collect();
    let mut cnt : usize = 0;
    fn next<T>(cnt: &mut usize, p: &Vec<&str>) -> T where T:std::str::FromStr
    { *cnt += 1; p[*cnt-1].parse().ok().unwrap() }
    ($(next::<$x>(&mut cnt, &s)), +)
    }}; }
#[allow(unused)] macro_rules! arr { ($n:expr, $T:ty) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let mut s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0);
    let mut v = Vec::new(); v.reserve(($n) as usize);
    for st in s { v.push(st.parse::<$T>().unwrap()); } v
    }}; }

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let a = scan!(i32);
    let b = scan!(i32);
    let c = scan!(i32);
    println!("{}", max(max(max(max(max(
        a + b + c,
        a * b * c),
        (a + b) * c),
        a + b * c),
        a * (b + c)),
        a * b + c));
}

fn input() -> u16 {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

fn main() {
    let (a, b, c) = (input(), input(), input());
    println!(
        "{}",
        [
            a + b + c,
            a + b * c,
            a * b + c,
            a * b * c,
            (a + b) * c,
            a * (b + c)
        ]
        .iter()
        .max()
        .unwrap()
    );
}

//spnauti-rust
#[allow(unused_imports)]
use std::io::{self,Read};

struct WordReader {
    it : std::vec::IntoIter<String>,
}
#[allow(dead_code)]
impl WordReader {
    fn new<T : Read>(mut reader : T) -> WordReader {
        let mut s = String::new();
        reader.read_to_string(&mut s).unwrap();
        WordReader { it : s
            .split_ascii_whitespace()
            .map(String::from).collect::<Vec<_>>()
            .into_iter()
        }
    }
    fn from_stdin() -> WordReader {
        WordReader::new(std::io::stdin())
    }
    fn s(&mut self) -> String {
        self.it.next().unwrap()
    }
    fn ab(&mut self) -> Vec<u8> {
        self.it.next().unwrap().into_bytes()
    }
    fn i(&mut self) -> i32 {
        self.it.next().unwrap().parse().unwrap()
    }
}

fn main() {
    let mut input = WordReader::from_stdin();
    let a = input.i();
    let b = input.i();
    let c = input.i();

    use std::cmp::max;
    let ab = max(a + b, a * b);
    let bc = max(b + c, b * c);
    let p = [ab + c, ab * c, a + bc, a * bc];
    let sol = p.iter().max().unwrap();
    println!("{}", sol);
}

fn main() {
    let a: i32 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.trim().parse().unwrap()
    };
    let b: i32 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.trim().parse().unwrap()
    };
    let c: i32 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line);
        line.trim().parse().unwrap()
    };

    let best = |a, b| std::cmp::max(a + b, a * b);
    let x = std::cmp::max(best(best(a, b), c), best(a, best(b, c)));
    println!("{:?}", x);
}

use std::io;

fn main() {
    let (mut a, mut b, mut c) = (String::new(), String::new(), String::new());
    io::stdin().read_line(&mut a).unwrap();
    io::stdin().read_line(&mut b).unwrap();
    io::stdin().read_line(&mut c).unwrap();
    let a: i64 = a.trim().parse().unwrap();
    let b: i64 = b.trim().parse().unwrap();
    let c: i64 = c.trim().parse().unwrap();

    let posibles: [i64; 6] = [
        (a + b) * c,
        a * (b + c),
        a + b + c,
        a * b + c,
        a + b * c,
        a * b * c,
    ];

    let max = posibles.iter().max().unwrap();

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

// {{{ by shik

use std::io;

#[allow(dead_code)]
fn gets() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(unused_macros)]
macro_rules! R {
    ( $ty:ty, ... ) => {
        gets().split_whitespace().map(|x| x.parse::<$ty>().unwrap()).collect::<Vec<_>>()
    };
    ( $($ty:ty),* ) => {{
        let line = gets();
        let mut it = line.split_whitespace();
        ( $(it.next().unwrap().parse::<$ty>().unwrap(),)* )
    }}
}

#[allow(unused_macros)]
macro_rules! W {
    ( $x:expr ) => {{
        println!("{}", $x);
    }};
    ( $x:expr, $($xs:expr),* ) => {{
        print!("{} ", $x);
        W!($($xs),*);
    }}
}

#[allow(unused_macros)]
macro_rules! join {
    ($x:expr, $($xs:expr),*; $sep:expr) => { concat!($x, $($sep, $xs),*) }
}

#[allow(unused_macros)]
macro_rules! dump {
    ($($x:expr),*) => {
        eprintln!(join!($(concat!(stringify!($x), " = {:?}")),*; ", "), $($x),*);
    }
}

// }}}

use std::cmp;

fn main() {
    let (a, ) = R!(i32);
    let (b, ) = R!(i32);
    let (c, ) = R!(i32);
    println!("{}", vec![a+b+c, a+b*c, a*b+c, a*b*c, (a+b)*c, a*(b+c)].into_iter().fold(0, cmp::max));
}

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

fn main() {
  let stdin = io::stdin();
  let mut s = String::new();
  stdin.read_line(&mut s).unwrap();
  let a: i32 = s.trim().parse().unwrap();
  let mut s = String::new();
  stdin.read_line(&mut s).unwrap();
  let b: i32 = s.trim().parse().unwrap();
  let mut s = String::new();
  stdin.read_line(&mut s).unwrap();
  let c: i32 = s.trim().parse().unwrap();

  let x = max(
    a+b+c, max(
    (a+b)*c, max(
    a*(b+c),
    a*b*c
    )));

  println!("{}", x);
  return;
}

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let a: i64 = read(sin);
    let b: i64 = read(sin);
    let c: i64 = read(sin);

    let ans = match (a, b, c) {
        (1, 1, 1) => 3,
        (a, 1, c) => if a < c {
            (a + 1) * c
        } else {
            a * (c + 1)
        },
        (1, b, 1) => b + 2,
        (1, b, c) => (1 + b) * c,
        (a, b, 1) => a * (b + 1),
        _ => a * b * c,
    };

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

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let a: i64 = read(sin);
    let b: i64 = read(sin);
    let c: i64 = read(sin);

    if b == 1 {
        let ans = if a <= c {
            if c == 1 {
                // a == b == c == 1
                a + b + c
            } else {
                (a + b) * c
            }
        } else {
            a * (b + c)
        };
        println!("{}", ans);
        return;
    }

    if c == 1 && a != 1 {
        println!("{}", a * (b + c));
        return;
    }

    let pre_val = if a == 1 { a + b } else { a * b };
    let ans = if c == 1 { pre_val + c } else { pre_val * c };

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

use std::io;

fn main() {
    let mut a = String::new();
    let mut b = String::new();
    let mut c = String::new();

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

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

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

    let a: i64 = a.trim().parse().unwrap();
    let b: i64 = b.trim().parse().unwrap();
    let c: i64 = c.trim().parse().unwrap();

    println!("{}",
             [
        (a+b)*c,
        a*b+c,
        a+b*c,
        a+b+c,
        a*b*c,
        a*(b+c)
    ]
    .iter()
    .max()
    .unwrap()
    );
}

use std::io;

fn main() {
    let mut a = String::new();
    let mut b = String::new();
    let mut c = String::new();

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

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

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

    let a: i64 = a.trim().parse().unwrap();
    let b: i64 = b.trim().parse().unwrap();
    let c: i64 = c.trim().parse().unwrap();

    let mut maxima = 0;
    let uno = (a+b)*c;
    let dos = a*b+c;
    maxima = std::cmp::max(uno,dos);
    let tres = a+b*c;
    maxima = std::cmp::max(maxima,tres);
    let cuatro = a+b+c;
    maxima = std::cmp::max(maxima,cuatro);
    let cinco = a*b*c;
    maxima = std::cmp::max(maxima,cinco);
    let seis = a*(b+c);
    maxima = std::cmp::max(maxima,seis);

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

use std::str::FromStr;

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn read_int<T: FromStr>() -> T{
    read_str().parse::<T>().ok().expect("Error")
}

fn main() {
    let (a, b, c): (u16, u16, u16) = (read_int(), read_int(), read_int());

    if a == 1 {
        if c == 1 { println!("{}", a + b + c); }
        else { println!("{}", (a + b) * c); }
    }
    else if b == 1 {
        if a > c { println!("{}", a * (b + c)); }
        else { println!("{}", (a + b) * c); }
    }
    else if c == 1 { println!("{}", a * (b + c)); }
    else { println!("{}", a * b * c); }
}

use std::str::FromStr;

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn read_int<T: FromStr>() -> T{
    read_str().parse::<T>().ok().expect("Error")
}

fn main() {
    let (a, b, c): (u16, u16, u16) = (read_int(), read_int(), read_int());

    if a + c == 2 { println!("{}", a + b + c); }
    else if a == 1 || b == 1 || c == 1 {
        if a < c { println!("{}", (a + b) * c); }
        else { println!("{}", a * (b + c)); }
    }
    else { println!("{}", a * b * c); }
}

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

fn read_line(stdin : &Stdin, line : &mut String) {
    match stdin.read_line(line) {
        Ok(_) => return,
        Err(msg) => panic!("Could not read line! Message: {}.", msg),
    }
}

fn parse_t<T : FromStr>(s : &str) -> T {
    match s.trim().parse() {
        Ok(y) => y,
        Err(_) => panic!("Could not read from string!"),
    }
}

fn read_t<T : FromStr>(stdin : &Stdin) -> T {
    let mut line = String::new();
    read_line(stdin, &mut line);
    parse_t(&line)
}

fn max_value(a : u64, b : u64, c : u64) -> u64 {
    let v = vec![a + b + c,
                 (a + b) * c,
                 (a * b) + c,
                 a * b * c,
                 a + (b * c),
                 a * (b + c)];
    match v.iter().max() {
        Some(&x) => x,
        None => panic!("Could not compute max value."),
    }
}

fn main() {
    let stdin = io::stdin();
    let a = read_t(&stdin);
    let b = read_t(&stdin);
    let c = read_t(&stdin);
    println!("{}", max_value(a, b, c));
}

fn readln() -> Vec<i32> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();

    line.split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect()
}

fn main() {
    let input = readln();
    let a = input[0];

    let input = readln();
    let b = input[0];

    let input = readln();
    let c = input[0];

    let mut ans = 0;

    // a + b + c
    ans = std::cmp::max(ans, a + b + c);

    // a + b * c
    ans = std::cmp::max(ans, a + b * c);

    // a * b + c
    ans = std::cmp::max(ans, a * b + c);

    // a * b * c
    ans = std::cmp::max(ans, a * b * c);

    // (a + b) * c
    ans = std::cmp::max(ans, (a + b) * c);

    // a * (b + c)
    ans = std::cmp::max(ans, a * (b + c));

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

// use rand::Rng;

use std::collections::*;
use std::io;

fn trim_newline(s: &mut String) {
    if s.ends_with('\n') {
        s.pop();
        if s.ends_with('\r') {
            s.pop();
        }
    }
}
macro_rules! parse_input {
    ($t:ident) => {{
        let mut input_line = String::new();
        io::stdin().read_line(&mut input_line).unwrap();
        trim_newline(&mut input_line);
        input_line.parse::<$t>().unwrap()
    }};
}

macro_rules! split_input {
    ($t:ident) => {{
        parse_input!(String)
            .split(" ")
            .map(|z| z.parse::<$t>().unwrap())
            .collect::<Vec<$t>>()
    }};
}

fn main() {
    let mut a = parse_input!(usize);
    let mut b = parse_input!(usize);
    let mut c = parse_input!(usize);
    if a == 1 {
        b += 1;
    }
    if b == 1 {
        if c < a {
            c += 1;
        } else {
            a += 1;
        }
    }
    if c == 1 {
        b += 1;
    }

    println!("{}", a * b * c);
}

use std::io;

fn main() {
    let mut a = String::new();
    let mut b = String::new();
    let mut c = String::new();

    io::stdin().read_line(&mut a).unwrap();
    io::stdin().read_line(&mut b).unwrap();
    io::stdin().read_line(&mut c).unwrap();

    let a: u16 = a.trim().parse().unwrap();
    let b: u16 = b.trim().parse().unwrap();
    let c: u16 = c.trim().parse().unwrap();

    let mut max_value: u16 = 0;

    if (a + b + c) > max_value {
        max_value = a + b + c;
    }
    if (a * b * c) > max_value {
        max_value = a * b * c;
    }
    if (a * b + c) > max_value {
        max_value = a * b + c;
    }
    if (a + b * c) > max_value {
        max_value = a + b * c;
    }

    if ((a + b) * c) > max_value {
        max_value = (a + b) * c;
    }
    if (a * (b + c)) > max_value {
        max_value = a * (b + c);
    }

    if (a + (b * c)) > max_value {
        max_value = a + (b * c);
    }
    if ((a * b) + c) > max_value {
        max_value = (a * b) + c;
    }

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

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_val() -> i32 {
    return read_line().parse().unwrap();
}

fn main() {
    let a = read_line_val();
    let b = read_line_val();
    let c = read_line_val();

    let results: [i32; 6] = [
        a + b + c,
        a + b * c,
        (a + b) * c,
        a * b + c,
        a * (b + c),
        a * b * c
    ];

    let mut max = 0;
    for r in results.iter() {
        if *r > max {
            max = *r;
        }
    }

    println!("{:?}", max);

}

use std::io::{BufWriter, stdin, stdout, Write};

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

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

	let a = scan.next::<i64>();
	let b = scan.next::<i64>();
	let c = scan.next::<i64>();

    let nums = [a + b + c,
               a + b * c,
               a * b * c,
               (a + b) * c,
               a * b + c,
               a * (b + c)];

    let res = nums.iter().max().unwrap();

    writeln!(out, "{}", res).expect("fail");
}

#[allow(unused)] use std::io::*;
#[allow(unused)] use std::collections::*;
#[allow(unused)] use std::mem::*;
#[allow(unused)] use std::num::*;
#[allow(unused)] use std::cmp::*;
#[allow(unused)] macro_rules! scan { ($($x:ty), +) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0).collect();
    let mut cnt : usize = 0;
    fn next<T>(cnt: &mut usize, p: &Vec<&str>) -> T where T:std::str::FromStr
    { *cnt += 1; p[*cnt-1].parse().ok().unwrap() }
    ($(next::<$x>(&mut cnt, &s)), +)
    }}; }
#[allow(unused)] macro_rules! arr { ($n:expr, $T:ty) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let mut s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0);
    let mut v = Vec::new(); v.reserve(($n) as usize);
    for st in s { v.push(st.parse::<$T>().unwrap()); } v
    }}; }

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let a = scan!(i32);
    let b = scan!(i32);
    let c = scan!(i32);
    println!("{}", max(max(max(a + b + c, a * b * c), (a + b) * c), a + b * c));
}

#[allow(unused)] use std::io::*;
#[allow(unused)] use std::collections::*;
#[allow(unused)] use std::mem::*;
#[allow(unused)] use std::num::*;
#[allow(unused)] use std::cmp::*;
#[allow(unused)] macro_rules! scan { ($($x:ty), +) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0).collect();
    let mut cnt : usize = 0;
    fn next<T>(cnt: &mut usize, p: &Vec<&str>) -> T where T:std::str::FromStr
    { *cnt += 1; p[*cnt-1].parse().ok().unwrap() }
    ($(next::<$x>(&mut cnt, &s)), +)
    }}; }
#[allow(unused)] macro_rules! arr { ($n:expr, $T:ty) => {{
    let mut inp = String::new(); stdin().read_line(&mut inp).ok();
    let mut s = inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0);
    let mut v = Vec::new(); v.reserve(($n) as usize);
    for st in s { v.push(st.parse::<$T>().unwrap()); } v
    }}; }

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let a = scan!(i32);
    let b = scan!(i32);
    let c = scan!(i32);
    println!("{}", max(max(max(max(a + b + c, a * b * c), (a + b) * c), (a + c) * b), (b + c) * a));
}

fn input() -> u8 {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

fn main() {
    let (a, b, c) = (input(), input(), input());
    println!(
        "{}",
        [
            a + b + c,
            a + b * c,
            a * b + c,
            a * b * c,
            (a + b) * c,
            a * (b + c)
        ]
        .iter()
        .max()
        .unwrap()
    );
}

use std::io;
use std::cmp::{min, max};

fn main() {
  let stdin = io::stdin();
  let mut s = String::new();
  stdin.read_line(&mut s).unwrap();
  let a: i32 = s.trim().parse().unwrap();
  let mut s = String::new();
  stdin.read_line(&mut s).unwrap();
  let b: i32 = s.trim().parse().unwrap();
  let mut s = String::new();
  stdin.read_line(&mut s).unwrap();
  let c: i32 = s.trim().parse().unwrap();

  let x = min(a, min(b, c));
  let z = max(a, max(b, c));
  let y = a + b + c - x - z;

  if x == 1 && y == 1 && z == 1 {
    println!("3");
  } else if x == 1 && y == 1 {
    println!("{}", 2*z);
  } else if x == 1 {
    println!("{}", (y+1)*z);
  } else {
    println!("{}", x*y*z);
  }
}

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let a: i64 = read(sin);
    let b: i64 = read(sin);
    let c: i64 = read(sin);

    let pre_val = if a == 1 || b == 1 { a + b } else { a * b };

    let ans = if c == 1 { pre_val + c } else { pre_val * c };

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

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let a: i8 = read(sin);
    let b: i8 = read(sin);
    let c: i8 = read(sin);

    let pre_val = if a == 1 || b == 1 { a + b } else { a * b };

    let ans = if c == 1 { pre_val + c } else { pre_val * c };

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

use std::io::*;

fn read<T: std::str::FromStr>(i: &mut StdinLock) -> T {
    let mut s = String::new();
    i.by_ref().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    // initialize stdin
    let sin = std::io::stdin();
    let mut sin = sin.lock();
    let sin = &mut sin;

    let a: i64 = read(sin);
    let b: i64 = read(sin);
    let c: i64 = read(sin);

    if b == 1 {
        let ans = if a <= c {
            if c == 1 {
                // a == b == c == 1
                a + b + c
            } else {
                (a + b) * c
            }
        } else {
            a * (b + c)
        };
        println!("{}", ans);
        return;
    }

    let pre_val = if a == 1 { a + b } else { a * b };
    let ans = if c == 1 { pre_val + c } else { pre_val * c };

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

use std::str::FromStr;

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn read_int<T: FromStr>() -> T{
    read_str().parse::<T>().ok().expect("Error")
}

fn main() {
    let (a, b, c): (u8, u8, u8) = (read_int(), read_int(), read_int());

    if a == 1 {
        if c == 1 { println!("{}", a + b + c); }
        else { println!("{}", (a + b) * c); }
    }
    else if b == 1 {
        if a > c { println!("{}", a * (b + c)); }
        else { println!("{}", (a + b) * c); }
    }
    else if c == 1 { println!("{}", a * (b + c)); }
    else { println!("{}", a * b * c); }
}

use std::str::FromStr;

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn read_int<T: FromStr>() -> T{
    read_str().parse::<T>().ok().expect("Error")
}

fn main() {
    let (a, b, c): (u16, u16, u16) = (read_int(), read_int(), read_int());

    if a + c == 2 { println!("{}", a + b + c); }
    else if b == 1 || c == 1 {
        if a < c { println!("{}", (a + b) * c); }
        else { println!("{}", a * (b + c)); }
    }
    else { println!("{}", a * b * c); }
}

// use rand::Rng;

use std::collections::*;
use std::io;

fn trim_newline(s: &mut String) {
    if s.ends_with('\n') {
        s.pop();
        if s.ends_with('\r') {
            s.pop();
        }
    }
}
macro_rules! parse_input {
    ($t:ident) => {{
        let mut input_line = String::new();
        io::stdin().read_line(&mut input_line).unwrap();
        trim_newline(&mut input_line);
        input_line.parse::<$t>().unwrap()
    }};
}

macro_rules! split_input {
    ($t:ident) => {{
        parse_input!(String)
            .split(" ")
            .map(|z| z.parse::<$t>().unwrap())
            .collect::<Vec<$t>>()
    }};
}

fn main() {
    let a = parse_input!(usize);
    let b = parse_input!(usize);
    let c = parse_input!(usize);
    let mut m = vec![a, b, c];
    m.sort();
    m.reverse();
    while *m.last().unwrap() == 1 {
        let p = m.pop().unwrap();
        *m.last_mut().unwrap() += p;
    }
    let mut ans = 1;
    for p in m {
        ans *= p;
    }
    println!("{}", ans);
}

// use rand::Rng;

use std::collections::*;
use std::io;

fn trim_newline(s: &mut String) {
    if s.ends_with('\n') {
        s.pop();
        if s.ends_with('\r') {
            s.pop();
        }
    }
}
macro_rules! parse_input {
    ($t:ident) => {{
        let mut input_line = String::new();
        io::stdin().read_line(&mut input_line).unwrap();
        trim_newline(&mut input_line);
        input_line.parse::<$t>().unwrap()
    }};
}

macro_rules! split_input {
    ($t:ident) => {{
        parse_input!(String)
            .split(" ")
            .map(|z| z.parse::<$t>().unwrap())
            .collect::<Vec<$t>>()
    }};
}

fn main() {
    let a = parse_input!(usize);
    let b = parse_input!(usize);
    let c = parse_input!(usize);
    let mut m = vec![a, b, c];
    m.sort();
    m.reverse();
    while *m.last().unwrap() == 1 {
        let p = m.pop().unwrap();
        *m.last_mut().unwrap() += p;
        m.sort();
        m.reverse();
    }
    let mut ans = 1;
    for p in m {
        ans *= p;
    }
    println!("{}", ans);
}

use std::io;

fn main() {
    let mut a = String::new();
    let mut b = String::new();
    let mut c = String::new();

    io::stdin().read_line(&mut a).unwrap();
    io::stdin().read_line(&mut b).unwrap();
    io::stdin().read_line(&mut c).unwrap();

    let a: u8 = a.trim().parse().unwrap();
    let b: u8 = b.trim().parse().unwrap();
    let c: u8 = c.trim().parse().unwrap();

    let mut max_value = 0;

    if (a + b + c) > max_value {
        max_value = a + b + c;
    }
    if (a * b * c) > max_value {
        max_value = a * b * c;
    }
    if (a * b + c) > max_value {
        max_value = a * b + c;
    }
    if (a + b * c) > max_value {
        max_value = a + b * c;
    }

    if ((a + b) * c) > max_value {
        max_value = (a + b) * c;
    }
    if (a * (b + c)) > max_value {
        max_value = a * (b + c);
    }

    if (a + (b * c)) > max_value {
        max_value = a + (b * c);
    }
    if ((a * b) + c) > max_value {
        max_value = (a * b) + c;
    }

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


Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before.It turns out that high school struggles are not gone. If someone is not like others, he is bullied. Vasya-8800 is an economy-class android which is produced by a little-known company. His design is not perfect, his characteristics also could be better. So he is bullied by other androids.One of the popular pranks on Vasya is to force him to compare $$$x^y$$$ with $$$y^x$$$. Other androids can do it in milliseconds while Vasya's memory is too small to store such big numbers.Please help Vasya! Write a fast program to compare $$$x^y$$$ with $$$y^x$$$ for Vasya, maybe then other androids will respect him.

On the only line of input there are two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^{9}$$$).

If $$$x^y < y^x$$$, then print '<' (without quotes). If $$$x^y > y^x$$$, then print '>' (without quotes). If $$$x^y = y^x$$$, then print '=' (without quotes).

NoteIn the first example $$$5^8 = 5 \cdot 5 \cdot 5 \cdot 5 \cdot 5 \cdot 5 \cdot 5 \cdot 5 = 390625$$$, and $$$8^5 = 8 \cdot 8 \cdot 8 \cdot 8 \cdot 8 = 32768$$$. So you should print '>'.In the second example $$$10^3 = 1000 < 3^{10} = 59049$$$.In the third example $$$6^6 = 46656 = 6^6$$$.

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

fn compare(x: i32, y: i32) -> i32 {
    if x == y {
        return 0;
    }
    if (x == 2 && y == 4) || (x == 4 && y == 2) {
        return 0;
    }

    if x <= 3 && y <= 3 {
        return if x < y { -1 } else { 1 };
    }
    if x >= 3 && y >= 3 {
        return if x < y { 1 } else { -1 };
    }

    if x == 1 {
        return -1;
    }
    if y == 1 {
        return 1;
    }

    if x <= 3 { 1 } else { -1 }
}

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

    let tokens: Vec<&str> = input.split_whitespace().collect();
    let x = tokens[0].parse::<i32>().unwrap();
    let y = tokens[1].parse::<i32>().unwrap();

    match compare(x, y) {
        -1 => println!("<"),
         0 => println!("="),
         1 => println!(">"),
         _ => println!("This shouldn't happen...")
    };
}

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

fn main() {
    let mut mut_line = String::new();
    io::stdin().read_line(&mut mut_line).unwrap();
    let mut iter = mut_line.trim().split(" ").map(|x| x.parse().unwrap());
    let (x, y): (u64, u64) = (iter.next().unwrap(), iter.next().unwrap());
    if x == y {
        println!("=");
        return;
    }
    let mini = cmp::min(x, y);
    let other = x + y - mini;
    let mut result = if mini >= 3 {
        cmp::Ordering::Greater
    } else if mini == 1 {
        cmp::Ordering::Less
    } else {
        // mini == 2
        if other == 3{
            cmp::Ordering::Less
        } else if other == 4 {
            cmp::Ordering::Equal
        }
        else{
            cmp::Ordering::Greater
        }
    };
    if mini == y {
        result = cmp::Ordering::reverse(result);
    }
    match result{
        cmp::Ordering::Less => println!("<"),
        cmp::Ordering::Equal => println!("="),
        cmp::Ordering::Greater => println!(">")
    }
}

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 x: u32 = it.next().unwrap().parse().unwrap();
    let y: u32 = it.next().unwrap().parse().unwrap();

    // x^y <?> y^x
    // exp(y * ln(x)) <?> exp(x * ln(y))
    // y * ln(x) <?> x * ln(y)
    // ln(x) / x <?> ln(y) / y

    struct F {
        x: u32,
    }

    use std::cmp::{Ordering, self};

    impl PartialEq for F {
        fn eq(&self, other: &F) -> bool {
            match (self.x, other.x) {
                (2, 4) | (4, 2) => true,
                (a, b) => a.eq(&b),
            }
        }
    }

    impl Eq for F {}

    impl PartialOrd for F {
        fn partial_cmp(&self, other: &F) -> Option<Ordering> {
            Some(self.cmp(other))
        }
    }

    impl Ord for F {
        fn cmp(&self, other: &F) -> Ordering {
            match (self.x, other.x) {
                (a, b) if F { x: a } == F { x: b } => Ordering::Equal,
                (3, _) => Ordering::Greater,
                (_, 3) => Ordering::Less,
                (2, _) => Ordering::Greater,
                (_, 2) => Ordering::Less,
                (1, _) => Ordering::Less,
                (_, 1) => Ordering::Greater,
                (a, b) => b.cmp(&a),
            }
        }
    }

    let x = F { x: x };
    let y = F { x: y };
    let ans = x.cmp(&y);
    let txt = match ans {
        Ordering::Less => '<',
        Ordering::Equal => '=',
        Ordering::Greater => '>',
    };

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

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 x: u32 = it.next().unwrap().parse().unwrap();
    let y: u32 = it.next().unwrap().parse().unwrap();

    // x^y <?> y^x
    // exp(y * ln(x)) <?> exp(x * ln(y))
    // y * ln(x) <?> x * ln(y)
    // ln(x) / x <?> ln(y) / y

    fn f_cmp(a: u32, b: u32) -> ::std::cmp::Ordering {
        use std::cmp::{self, Ordering};

        if a == b {
            Ordering::Equal
        } else if a == 1 {
            Ordering::Less
        } else if b == 1 {
            Ordering::Greater
        } else if a == 3 {
            Ordering::Greater
        } else if b == 3 {
            Ordering::Less
        } else if a == 2 || a == 4 {
            if b == 2 || b == 4 {
                Ordering::Equal
            } else {
                Ordering::Greater
            }
        } else if b == 2 || b == 4 {
            Ordering::Less
        } else {
            b.cmp(&a)
        }
    }

    let ans = f_cmp(x, y);
    use std::cmp::Ordering;
    let txt = match ans {
        Ordering::Less => '<',
        Ordering::Equal => '=',
        Ordering::Greater => '>',
    };

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

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 x: f64 = it.next().unwrap().parse().unwrap();
    let y: f64 = it.next().unwrap().parse().unwrap();

    // x^y <?> y^x
    // exp(y * ln(x)) <?> exp(x * ln(y))
    // y * ln(x) <?> x * ln(y)
    // ln(x) / x <?> ln(y) / y

    let epsilon = 1e-4;

    let diff = x * y.ln() - y * x.ln();

    let ans = if diff.abs() < epsilon {
        '='
    } else if diff > 0.0 {
        '<'
    } else {
        '>'
    };

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

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

fn compare(x: i32, y: i32) -> i32 {
    if x == y {
        return 0;
    }
    if (x == 2 && y == 4) || (x == 4 && y == 2) {
        return 0;
    }

    if x <= 3 && y <= 3 {
        return if x < y { -1 } else { 1 };
    }
    if x >= 3 && y >= 3 {
        return if x < y { 1 } else { -1 };
    }

    if x == 1 {
        return -1;
    }
    if y == 1 {
        return -1;
    }

    if x <= 3 { 1 } else { -1 }
}

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

    let tokens: Vec<&str> = input.split_whitespace().collect();
    let x = tokens[0].parse::<i32>().unwrap();
    let y = tokens[1].parse::<i32>().unwrap();

    match compare(x, y) {
        -1 => println!("<"),
         0 => println!("="),
         1 => println!(">"),
         _ => println!("This shouldn't happen...")
    };
}


Alice and Bob are playing a game with $$$n$$$ piles of stones. It is guaranteed that $$$n$$$ is an even number. The $$$i$$$-th pile has $$$a_i$$$ stones.Alice and Bob will play a game alternating turns with Alice going first.On a player's turn, they must choose exactly $$$\frac{n}{2}$$$ nonempty piles and independently remove a positive number of stones from each of the chosen piles. They can remove a different number of stones from the piles in a single turn. The first player unable to make a move loses (when there are less than $$$\frac{n}{2}$$$ nonempty piles).Given the starting configuration, determine who will win the game.

The first line contains one integer $$$n$$$ ($$$2 \leq n \leq 50$$$) — the number of piles. It is guaranteed that $$$n$$$ is an even number. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the number of stones in the piles.

Print a single string "Alice" if Alice wins; otherwise, print "Bob" (without double quotes).

NoteIn the first example, each player can only remove stones from one pile ($$$\frac{2}{2}=1$$$). Alice loses, since Bob can copy whatever Alice does on the other pile, so Alice will run out of moves first.In the second example, Alice can remove $$$2$$$ stones from the first pile and $$$3$$$ stones from the third pile on her first move to guarantee a win.

//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: Vec::new(), 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 = Vec::with_capacity(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 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()
	}
}
//------------------- End rusT }}}

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

	let n = rin.u();
	let mut a = rin.vi(n);
	a.sort();
	let mut c = 0;
	while c < n && a[0] == a[c] {
		c += 1;
	}
	if c <= n/2 {
		writeln!(rout, "Alice").ok();
	} else {
		writeln!(rout, "Bob").ok();
	}
}

//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 run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut a = a;
    a.sort();
    let ans = if a[0] == a[n / 2] {
        "Bob"
    } else {
        "Alice"
    };
    println!("{}", ans);
}

fn main() {
    run();
}

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

fn solve<R: BufRead, W: Write>(mut input: FastInput<R>, mut w: W) {
    let n: usize = input.token();
    let mut a = vec![0usize; n];
    for x in a.iter_mut() {
        *x = input.token();
    }
    let min = a.iter().min().unwrap();
    let cnt = a.iter().filter(|&x| x == min).count();
    if cnt > n / 2 {
        write!(w, "Bob\n");
    } else {
        write!(w, "Alice\n");
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

fn main1() {
    let mut scan = Scanner::new();
    let n = scan.next::<usize>();

    let mut lo = 99;
    let mut rep = 0;
    for _ in 0..n {
        let a = scan.next::<usize>();
        if lo > a {
            lo = a;
            rep = 0;
        }
        if lo == a {
            rep += 1;
        }
    }
    if rep <= n / 2 {
        println!("Alice");
    } else {
        println!("Bob");
    }
}

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

//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 run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut cnt = vec![0; 10];
    for a in a {
        for i in 0..10 {
            cnt[i] += (a >> i) & 1;
        }
    }
    for i in 0..10 {
        if cnt[i] % (n / 2) != 0 {
            println!("Alice");
            return;
        }
    }
    println!("Bob");
}

fn main() {
    run();
}


The only king stands on the standard chess board. You are given his position in format "cd", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king.Check the king's moves here https://en.wikipedia.org/wiki/King_(chess).  King moves from the position e4

The only line contains the king's position in the format "cd", where 'c' is the column from 'a' to 'h' and 'd' is the row from '1' to '8'.

Print the only integer x — the number of moves permitted for the king.

fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).expect("Error");
    let letter = line.chars().nth(0).expect("Error");
    let number = line.chars().nth(1).expect("Error");
    let array = [letter, number];

    fn boundary(a: char) -> bool {
        match a {
            'a' | 'h' | '1' | '8' => true,
            _ => false,
        }
    }
    let cnt = array.iter().map(|x| boundary(*x)).filter(|x| *x).count();

    let res = match cnt {
        0 => 8,
        1 => 5,
        2 => 3,
        _ => unreachable!(),
    };
    println!("{}", res);
}

use std::io;

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

    io::stdin().read_line(&mut guess)
        .expect("Failed to read whatever you enter");

    let first = guess.chars().nth(0).unwrap();
    let second = guess.chars().nth(1).unwrap();
    let mut allow = 8;
    let mut left_or_rigt_most = false;

    if first == 'a' || first == 'h' {
        left_or_rigt_most = true;
        allow -= 3;
    }

    if second == '1' || second == '8' {
        if left_or_rigt_most {
            allow -= 2;
        } else {
            allow -= 3;
        }
    }

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

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

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

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

impl Scanner {

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

   fn next<T : std::str::FromStr >(&mut self) -> T {

      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      let front = self.buffer.pop_front().unwrap();
      front.parse::<T>().ok().unwrap()
   }
}

fn main() {
   let mut s = Scanner::new();
   let input = s.next::<String>();
   let mut iter = input.chars();
   let column = iter.next().unwrap();
   let row = iter.next().unwrap();

   if column == 'a' || column == 'h' {
      if row == '1' || row == '8' {
         println!("3");
      } else {
         println!("5");
      }
   } else if row == '1' || row == '8' {
      if column == 'a' || column == 'h' {
         println!("3");
      } else {
         println!("5");
      }
   } else {
      println!("8");
   }
}

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

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

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

impl Scanner {

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

   fn next<T : std::str::FromStr >(&mut self) -> T {

      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      let front = self.buffer.pop_front().unwrap();
      front.parse::<T>().ok().unwrap()
   }
}

fn main() {
   let mut s = Scanner::new();
   let input : String = s.next();
   println!("8");
}


The preferred way to generate user login in Polygon is to concatenate a prefix of the user's first name and a prefix of their last name, in that order. Each prefix must be non-empty, and any of the prefixes can be the full name. Typically there are multiple possible logins for each person.You are given the first and the last name of a user. Return the alphabetically earliest login they can get (regardless of other potential Polygon users).As a reminder, a prefix of a string s is its substring which occurs at the beginning of s: "a", "ab", "abc" etc. are prefixes of string "{abcdef}" but "b" and 'bc" are not. A string a is alphabetically earlier than a string b, if a is a prefix of b, or a and b coincide up to some position, and then a has a letter that is alphabetically earlier than the corresponding letter in b: "a" and "ab" are alphabetically earlier than "ac" but "b" and "ba" are alphabetically later than "ac".

The input consists of a single line containing two space-separated strings: the first and the last names. Each character of each string is a lowercase English letter. The length of each string is between 1 and 10, inclusive.

Output a single string — alphabetically earliest possible login formed from these names. The output should be given in lowercase as well.

use std::io::stdin;
fn main() {
    let mut text = String::new();
    stdin().read_line(&mut text).unwrap();
    let text: Vec<&str> = text.trim().split_whitespace().collect();
    let mut value = 0;

    let mut val: Vec<String> = vec![];
    let a = text[0].chars().collect::<Vec<char>>();
    let b = text[1].chars().collect::<Vec<char>>();
    let mut text1 = String::new();
    for x in &a {
        text1.push(*x);
        let mut text2 = String::new();

        for y in &b {
            text2.push(*y);
            val.push(text1.clone() + &text2[..]);
        }
    }
    val.sort();
    println!("{}", val[0]);
}

use std::io::stdin;
fn main() {
    let mut text = String::new();
    stdin().read_line(&mut text).unwrap();
    let text: Vec<&str> = text.trim().split_whitespace().collect();

    let mut val: Vec<String> = vec![];
    let a = text[0].chars().collect::<Vec<char>>();
    let b = text[1].chars().collect::<Vec<char>>();
    let mut text1 = String::new();
    if a.len() > 1 {
        for x in &a[1..] {
            if x < &b[0] {
                text1.push(*x);
            } else {
                break;
            }
        }
    }
    val.sort();
    println!("{}{}{}", a[0], text1, b[0]);
}

use std::io;

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

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

    let parts: Vec<&str> = input.trim().split(' ').collect();
    let mut logins: Vec<String> = vec![];

    for i in 1..(parts[0].len()+1) {
        for j in 1..(parts[1].len()+1) {
            let mut login = String::new();
            login.push_str(&parts[0][0..i]);
            login.push_str(&parts[1][0..j]);
            logins.push(login);
        }
    }

    logins.sort();

    println!("{}", logins[0]);
}


Mister B once received a gift: it was a book about aliens, which he started read immediately. This book had c pages.At first day Mister B read v0 pages, but after that he started to speed up. Every day, starting from the second, he read a pages more than on the previous day (at first day he read v0 pages, at second — v0 + a pages, at third — v0 + 2a pages, and so on). But Mister B is just a human, so he physically wasn't able to read more than v1 pages per day.Also, to refresh his memory, every day, starting from the second, Mister B had to reread last l pages he read on the previous day. Mister B finished the book when he read the last page for the first time.Help Mister B to calculate how many days he needed to finish the book.

First and only line contains five space-separated integers: c, v0, v1, a and l (1 ≤ c ≤ 1000, 0 ≤ l < v0 ≤ v1 ≤ 1000, 0 ≤ a ≤ 1000) — the length of the book in pages, the initial reading speed, the maximum reading speed, the acceleration in reading speed and the number of pages for rereading.

Print one integer — the number of days Mister B needed to finish the book.

NoteIn the first sample test the book contains 5 pages, so Mister B read it right at the first day.In the second sample test at first day Mister B read pages number 1 - 4, at second day — 4 - 11, at third day — 11 - 12 and finished the book.In third sample test every day Mister B read 1 page of the book, so he finished in 15 days.

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

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

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

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

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

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

fn main() {
  scanln!(c: u32, v0: u32, v1: u32, a: u32, l: u32);
  let mut speed = v0;
  let mut pages = 0;
  let mut days = 0;
  loop {
    days += 1;
    pages += speed;
    if pages >= c { break; }
    speed = std::cmp::min(speed + a, v1);
    pages -= l;
  }
  println!("{}", days);
}


Dima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework.The teacher gave Seryozha the coordinates of n distinct points on the abscissa axis and asked to consecutively connect them by semi-circus in a certain order: first connect the first point with the second one, then connect the second point with the third one, then the third one with the fourth one and so on to the n-th point. Two points with coordinates (x1, 0) and (x2, 0) should be connected by a semi-circle that passes above the abscissa axis with the diameter that coincides with the segment between points. Seryozha needs to find out if the line on the picture intersects itself. For clarifications, see the picture Seryozha showed to Dima (the left picture has self-intersections, the right picture doesn't have any).  Seryozha is not a small boy, so the coordinates of the points can be rather large. Help Dima cope with the problem.

The first line contains a single integer n (1 ≤ n ≤ 103). The second line contains n distinct integers x1, x2, ..., xn ( - 106 ≤ xi ≤ 106) — the i-th point has coordinates (xi, 0). The points are not necessarily sorted by their x coordinate.

In the single line print "yes" (without the quotes), if the line has self-intersections. Otherwise, print "no" (without the quotes).

NoteThe first test from the statement is on the picture to the left, the second test is on the picture to the right.

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

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

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

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

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

fn interval(a: isize, b: isize) -> (isize, isize) {
    (a.min(b), a.max(b))
}

fn clash(inter1: (isize, isize), inter2: (isize, isize)) -> bool {
    inter1.0 < inter2.0 && inter2.0 < inter1.1 && inter1.1 < inter2.1
        || inter2.0 < inter1.0 && inter1.0 < inter2.1 && inter2.1 < inter1.1
}

fn _main() {
    let mut scan = Scan::new();
    let n: usize = scan.next();
    let arr: Vec<isize> = scan.next_n(n);
    let mut inters: Vec<(isize, isize)> = vec![];
    for i in 1..arr.len() {
        let current = interval(arr[i], arr[i - 1]);
        for &inter in &inters {
            if clash(current, inter) {
                println!("yes");
                return;
            }
        }
        inters.push(current);
    }
    println!("no");
}

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

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

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

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

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

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

fn interval(a: isize, b: isize) -> (isize, isize) {
    (a.min(b), a.max(b))
}

fn clash(inter1: (isize, isize), inter2: (isize, isize)) -> bool {
    inter1.0 < inter2.0 && inter1.1 < inter2.1 || inter2.0 < inter1.0 && inter2.1 < inter1.1
}

fn _main() {
    let mut scan = Scan::new();
    let n: usize = scan.next();
    let arr: Vec<isize> = scan.next_n(n);
    let mut inters: Vec<(isize, isize)> = vec![];
    for i in 1..arr.len() {
        let current = interval(arr[i], arr[i - 1]);
        for &inter in &inters {
            if clash(current, inter) {
                println!("yes");
                return;
            }
        }
        inters.push(current);
    }
    println!("no");
}

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


Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.The game is played on the following field.  Players are making moves by turns. At first move a player can put his chip in any cell of any small field. For following moves, there are some restrictions: if during last move the opposite player put his chip to cell with coordinates (xl, yl) in some small field, the next move should be done in one of the cells of the small field with coordinates (xl, yl). For example, if in the first move a player puts his chip to lower left cell of central field, then the second player on his next move should put his chip into some cell of lower left field (pay attention to the first test case). If there are no free cells in the required field, the player can put his chip to any empty cell on any field.You are given current state of the game and coordinates of cell in which the last move was done. You should find all cells in which the current player can put his chip.A hare works as a postman in the forest, he likes to foul bears. Sometimes he changes the game field a bit, so the current state of the game could be unreachable. However, after his changes the cell where the last move was done is not empty. You don't need to find if the state is unreachable or not, just output possible next moves according to the rules.

First 11 lines contains descriptions of table with 9 rows and 9 columns which are divided into 9 small fields by spaces and empty lines. Each small field is described by 9 characters without spaces and empty lines. character "x" (ASCII-code 120) means that the cell is occupied with chip of the first player, character "o" (ASCII-code 111) denotes a field occupied with chip of the second player, character "." (ASCII-code 46) describes empty cell. The line after the table contains two integers x and y (1 ≤ x, y ≤ 9). They describe coordinates of the cell in table where the last move was done. Rows in the table are numbered from up to down and columns are numbered from left to right. It's guaranteed that cell where the last move was done is filled with "x" or "o". Also, it's guaranteed that there is at least one empty cell. It's not guaranteed that current state of game is reachable.

Output the field in same format with characters "!" (ASCII-code 33) on positions where the current player can put his chip. All other cells should not be modified.

NoteIn the first test case the first player made a move to lower left cell of central field, so the second player can put a chip only to cells of lower left field.In the second test case the last move was done to upper left cell of lower central field, however all cells in upper left field are occupied, so the second player can put his chip to any empty cell.In the third test case the last move was done to central cell of central field, so current player can put his chip to any cell of central field, which is already occupied, so he can move anywhere. Pay attention that this state of the game is unreachable.

#[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;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let mut field: Vec<Vec<char>> = (0..11).map(|_| util::line().chars().collect()).collect();
    let (mut y, mut x) = get!(usize, usize);

    y -= 1;
    x -= 1;

    let ry = y - 3 * (y / 3);
    let rx = x - 3 * (x / 3);

    let sy = 4 * ry;
    let sx = 4 * rx;

    if (sy..sy + 3).all(|y1| (sx..sx + 3).all(|x1| field[y1][x1] != '.')) {
        for v in field.iter_mut() {
            for c in v.iter_mut() {
                if *c == '.' {
                    *c = '!';
                }
            }
        }
    } else {
        for y1 in sy..sy + 3 {
            for x1 in sx..sx + 3 {
                if field[y1][x1] == '.' {
                    field[y1][x1] = '!';
                }
            }
        }
    }

    for line in &field {
        println!(
            "{}",
            line.iter()
                .map(|c| c.to_string())
                .collect::<Vec<_>>()
                .join("")
        );
    }
}

// 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 mut field = vec![vec![]; 9];
    for i in 0..9 {
        for _ in 0..3 {
            field[i].push(get().as_bytes());
        }
    }
    let y = (get!(usize) - 1) % 3;
    let x = (get!(usize) - 1) % 3;

    let mut c = 0;
    for i in 0..3 {
        for &ch in &field[y*3+i][x][..] {
            if ch == b'.' {
                c += 1;
            }
        }
    }
    if c == 0 {
        for i in 0..9 {
            for j in 0..3 {
                if j > 0 { print!(" "); }
                for k in 0..3 {
                    let ch = field[i][j][k];
                    if ch == b'.' {
                        print!("!");
                    } else {
                        print!("{}", ch as char);
                    }
                }
            }
            println!();
            if i % 3 == 2 { println!(); }
        }
        return;
    }
    for i in 0..9 {
        for j in 0..3 {
            if j > 0 { print!(" "); }
            for k in 0..3 {
                let ch = field[i][j][k];
                if ch == b'.' && j == x && i / 3 == y {
                    print!("!");
                } else {
                    print!("{}", ch as char);
                }
            }
        }
        println!();
        if i % 3 == 2 { println!(); }
    }
}

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

    let p = input.bytes().position(|b| b'0' <= b && b <= b'9').unwrap();

    let grid: Vec<_> = input.as_bytes()[0..p].iter().filter_map(|&b| match b {
        b'.' => Some(Cell::Empty),
        b'x' => Some(Cell::Chip1),
        b'o' => Some(Cell::Chip2),
        _ => None,
    }).collect();

    let check = |x: usize, y: usize, grid: &Vec<Cell>| {
        let x_off = 27 * x;
        let y_off = 3 * y;
        let mut it = grid[x_off + y_off..].iter().take(3)
            .chain(grid[x_off + y_off + 9..].iter().take(3))
            .chain(grid[x_off + y_off + 18..].iter().take(3));

        !it.all(|cell| match *cell {
            Cell::Empty => false,
            _ => true,
        })
    };

    let mut it = input[p..].split_whitespace();
    let x: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
    let y: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;

    let bx = x % 3;
    let by = y % 3;

    let ans: Vec<_> = if !check(bx, by, &grid) {
        grid.into_iter().map(|cell| match cell {
            Cell::Empty => Cell::Possible,
            _ => cell,
        }).collect()
    } else {
        grid.into_iter().enumerate().map(|(i, cell)| {
            let x = i / 9;
            let y = i % 9;
            match cell {
                Cell::Empty if x / 3 == bx && y / 3 == by => Cell::Possible,
                _ => cell,
            }
        }).collect()
    };

    let mut ans_str = Vec::with_capacity(2 * p);

    for (i, cell) in ans.into_iter().enumerate() {
        let next = match cell {
            Cell::Empty => b'.',
            Cell::Chip1 => b'x',
            Cell::Chip2 => b'o',
            Cell::Possible => b'!',
        };

        ans_str.push(next);

        if i % 27 == 26 {
            ans_str.push(b'\n');
        }
        if i % 9 == 8 {
            ans_str.push(b'\n');
        } else if i % 3 == 2 {
            ans_str.push(b' ');
        }
    }

    let ans = String::from_utf8(ans_str).unwrap();

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

#[derive(Debug)]
enum Cell {
    Empty,
    Chip1,
    Chip2,
    Possible,
}

// 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 mut field = vec![vec![]; 9];
    for i in 0..9 {
        for _ in 0..3 {
            field[i].push(get().as_bytes());
        }
    }
    let y = (get!(usize) - 1) % 3;
    let x = (get!(usize) - 1) % 3;

    let mut c = 0;
    for i in 0..3 {
        for &ch in &field[y*3+i][x][..] {
            if ch == b'.' {
                c += 1;
            }
        }
    }
    if c == 0 {
        for i in 0..9 {
            for j in 0..3 {
                if j > 0 { print!(" "); }
                for k in 0..3 {
                    let ch = field[i][j][k];
                    if ch == b'.' {
                        print!("!");
                    } else {
                        print!("{}", ch as char);
                    }
                }
            }
            println!();
        }
        return;
    }
    for i in 0..9 {
        for j in 0..3 {
            if j > 0 { print!(" "); }
            for k in 0..3 {
                let ch = field[i][j][k];
                if ch == b'.' && j == x && i / 3 == y {
                    print!("!");
                } else {
                    print!("{}", ch as char);
                }
            }
        }
        println!();
    }
}

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

    let p = input.bytes().position(|b| b'0' <= b && b <= b'9').unwrap();

    let grid: Vec<_> = input.as_bytes()[0..p].iter().filter_map(|&b| match b {
        b'.' => Some(Cell::Empty),
        b'x' => Some(Cell::Chip1),
        b'o' => Some(Cell::Chip2),
        _ => None,
    }).collect();

    let check = |x: usize, y: usize, grid: &Vec<Cell>| {
        let x_off = 27 * x;
        let y_off = 3 * y;
        let mut it = grid[x_off + y_off..].iter().take(3)
            .chain(grid[x_off + y_off + 9..].iter().take(3))
            .chain(grid[x_off + y_off + 18..].iter().take(3));

        !it.all(|cell| match *cell {
            Cell::Empty => false,
            _ => true,
        })
    };

    let mut it = input[p..].split_whitespace();
    let x: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
    let y: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;

    let bx = x % 3;
    let by = y % 3;

    let ans: Vec<_> = if !check(bx, by, &grid) {
        grid.into_iter().map(|cell| match cell {
            Cell::Empty => Cell::Possible,
            _ => cell,
        }).collect()
    } else {
        grid.into_iter().enumerate().map(|(i, cell)| {
            let x = i / 9;
            let y = i % 9;
            match cell {
                Cell::Empty if x / 3 == bx && y / 3 == by => Cell::Possible,
                _ => cell,
            }
        }).collect()
    };

    let mut ans_str = Vec::with_capacity(2 * p);

    for (i, cell) in ans.into_iter().enumerate() {
        let next = match cell {
            Cell::Empty => b'.',
            Cell::Chip1 => b'x',
            Cell::Chip2 => b'o',
            Cell::Possible => b'!',
        };

        ans_str.push(next);

        if i % 9 == 8 {
            ans_str.push(b'\n');
        } else if i % 3 == 2 {
            ans_str.push(b' ');
        }
    }

    let ans = String::from_utf8(ans_str).unwrap();

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

#[derive(Debug)]
enum Cell {
    Empty,
    Chip1,
    Chip2,
    Possible,
}


Tokitsukaze is one of the characters in the game "Kantai Collection". In this game, every character has a common attribute — health points, shortened to HP.In general, different values of HP are grouped into $$$4$$$ categories:  Category $$$A$$$ if HP is in the form of $$$(4 n + 1)$$$, that is, when divided by $$$4$$$, the remainder is $$$1$$$;  Category $$$B$$$ if HP is in the form of $$$(4 n + 3)$$$, that is, when divided by $$$4$$$, the remainder is $$$3$$$;  Category $$$C$$$ if HP is in the form of $$$(4 n + 2)$$$, that is, when divided by $$$4$$$, the remainder is $$$2$$$;  Category $$$D$$$ if HP is in the form of $$$4 n$$$, that is, when divided by $$$4$$$, the remainder is $$$0$$$. The above-mentioned $$$n$$$ can be any integer.These $$$4$$$ categories ordered from highest to lowest as $$$A > B > C > D$$$, which means category $$$A$$$ is the highest and category $$$D$$$ is the lowest.While playing the game, players can increase the HP of the character. Now, Tokitsukaze wants you to increase her HP by at most $$$2$$$ (that is, either by $$$0$$$, $$$1$$$ or $$$2$$$). How much should she increase her HP so that it has the highest possible category?

The only line contains a single integer $$$x$$$ ($$$30 \leq x \leq 100$$$) — the value Tokitsukaze's HP currently.

Print an integer $$$a$$$ ($$$0 \leq a \leq 2$$$) and an uppercase letter $$$b$$$ ($$$b \in \lbrace A, B, C, D \rbrace$$$), representing that the best way is to increase her HP by $$$a$$$, and then the category becomes $$$b$$$. Note that the output characters are case-sensitive.

NoteFor the first example, the category of Tokitsukaze's HP is already $$$A$$$, so you don't need to enhance her ability.For the second example:  If you don't increase her HP, its value is still $$$98$$$, which equals to $$$(4 \times 24 + 2)$$$, and its category is $$$C$$$.  If you increase her HP by $$$1$$$, its value becomes $$$99$$$, which equals to $$$(4 \times 24 + 3)$$$, and its category becomes $$$B$$$.  If you increase her HP by $$$2$$$, its value becomes $$$100$$$, which equals to $$$(4 \times 25)$$$, and its category becomes $$$D$$$. Therefore, the best way is to increase her HP by $$$1$$$ so that the category of her HP becomes $$$B$$$.

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

    let vec = vec![
        hp_judge(0, number),
        hp_judge(1, number),
        hp_judge(2, number),
    ];

    let outcome = great_hp(vec);

    println!("{} {}", outcome.0, outcome.1);

}

fn great_hp(hp_vec: Vec<(i32, i32)>) -> (i32, String) {
    let mut best_hp = (i32::default(), i32::default());

    for item in hp_vec.iter() {
        if item.1 > best_hp.1 {
            best_hp = *item;
        }
    }

    convert(best_hp)
}

fn hp_judge(offset: i32, number: i32) -> (i32, i32) {
    ( offset, grade_estimation(number + offset) )
}

fn grade_estimation(hp: i32) -> i32 {
    let reminder = hp % 4;

    match reminder {
        0 => { 0 },
        1 => { 3 },
        2 => { 1 },
        3 => { 2 },
        _ => { -1 },

    }
}

fn convert(hp: (i32, i32)) -> (i32 ,String) {
    match hp.1 {
        0 => { (hp.0, String::from("D")) },
        3 => { (hp.0, String::from("A")) },
        1 => { (hp.0, String::from("C")) },
        2 => { (hp.0, String::from("B")) },
        _ => { (hp.0, String::from("Err")) },
    }
}

macro_rules! parse {
    () => {{
        let mut buffer = String::new();
        std::io::stdin().read_line(&mut buffer).expect("Could not fetch value from stdin");
        buffer.trim().parse().expect("Could not convert input")
    }};
}

fn main() {
    let hp: u32 = parse!();
    let current_category = hp % 4;
    match current_category {
        0 => println!("1 A"),
        1 => println!("0 A"),
        2 => println!("1 B"),
        3 => println!("2 A"),
        _ => unreachable!("Since mod 4 this should not be reachable"),
    };
}

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

    let (a, category) = match x % 4 {
        0 => (1, 'A'),
        1 => (0, 'A'),
        2 => (1, 'B'),
        3 => (2, 'A'),
        _ => unreachable!()
    };

    println!("{} {}", a, category);
}

//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 x = input.u();
    let a = [3,0,2,1];
    let mut soli = 0;
    let mut sola = a[x % 4];
    for i in 1..=2 {
        let x = x + i;
        if m!(<,sola,a[x % 4]) {
            soli = i;
        }
    }
    println!("{} {}", soli, (sola + b'A') as char);
}

use std::collections::HashMap;

fn read_string() -> String {
    let mut string: String = String::new();

    std::io::stdin().read_line(&mut string)
        .ok()
        .expect("Error read line!");
    return string;
}

fn main() {

    let hp : i32 = read_string().trim().parse().ok().expect("not int");

    let mut category : HashMap<i32, &str> = HashMap::new();
    category.insert(1, "0 A");
    category.insert(3, "2 A");
    category.insert(2, "1 B");
    category.insert(0, "1 A");
    println!("{}", category[&(hp % 4)]);
}

#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
struct Score{
    grade: String,
    score: i32
}

fn calculate_grade(grade: i32) -> String{
    let mut words : String;
    match grade {
        1 => words = String::from("A"),
        2 => words = String::from("C"),
        3 => words = String::from("B"),
        _ => words = String::from("D")
    }
    words
}

fn main() {
    let mut t: String = String::new();
    std::io::stdin().read_line(&mut t).expect("input");
    let counter:Vec<i32> = t.trim()
        .split_whitespace()
        .map(|x| x.parse::<i32>().expect("Not an Integer!"))
        .collect();

    let mut list_of_score : Vec<Score> = Vec::new();
    for i in 0..3{
        list_of_score.push( Score {
            score: i ,
            grade: calculate_grade((counter[0] + i) % 4)
        })
    }
    list_of_score.sort();
    println!("{} {}", list_of_score[0].score, list_of_score[0].grade);
}

// Template adapted from submissions by https://codeforces.com/profile/EbTech

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

#[derive(Default)]
struct Scanner(Vec<String>);
impl Scanner {
    fn read<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.0.pop() {
                return token.parse().ok().unwrap();
            }
            let mut input = String::new();
            stdin().read_line(&mut input).unwrap();
            self.0 = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

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

    let x: u8 = cin.read();
    let (a, b) = match x % 4 {
        1 => (0, 'A'),
        3 => (2, 'A'),
        2 => (1, 'B'),
        0 => (1, 'A'),
        _ => unreachable!(),
    };

    writeln!(cout, "{} {}", a, b).unwrap();
}

use std::io::*;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

pub fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let x = i.read::<u32>();

    let (a, b) = solve(x);
    writeln!(o, "{} {}", a, b).unwrap();
}
fn solve(x: u32) -> (u32, char) {
    fn to_category(x: u32) -> char {
        match x % 4 {
            1 => 'A',
            3 => 'B',
            2 => 'C',
            0 => 'D',
            _ => unreachable!(),
        }
    }
    [0, 1, 2]
        .iter()
        .map(|&a| (a, to_category(x + a)))
        .min_by_key(|&(_a, c)| c)
        .unwrap()
}

pub mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        b: Vec<u8>,
    }
    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                b: Vec::new(),
            }
        }
        pub fn read_word(&mut self) -> &[u8] {
            self.b.clear();
            let mut consume = 0;
            loop {
                self.r.consume(consume);
                let b = self.r.fill_buf().unwrap();
                assert!(b.len() != 0);
                if let Some(p) = b.iter().position(|&x| x.is_ascii_whitespace()) {
                    self.b.extend_from_slice(&b[..p]);
                    consume = p + 1;
                    break;
                }
                self.b.extend_from_slice(b);
                consume = b.len();
            }
            self.r.consume(consume);
            consume_ws(&mut self.r);
            &self.b
        }
        pub fn read_word_str(&mut self) -> &str {
            unsafe { std::str::from_utf8_unchecked(self.read_word()) }
        }

        pub fn read_line(&mut self) -> &[u8] {
            self.b.clear();
            self.r.read_until(b'\n', &mut self.b).unwrap();
            let end = self
                .b
                .iter()
                .rposition(|x| !x.is_ascii_whitespace())
                .map(|idx| idx + 1)
                .unwrap_or(0);
            &self.b[..end]
        }
        pub fn read_line_str(&mut self) -> &str {
            unsafe { std::str::from_utf8_unchecked(self.read_line()) }
        }

        pub fn read<T: CpIn>(&mut self) -> T {
            T::read_from(self)
        }

        pub fn read_vec<T: CpIn>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read()).collect()
        }
        pub fn read_iter<'a, T: CpIn>(&'a mut self, n: usize) -> CpIter<'a, R, T> {
            CpIter {
                r: self,
                n: n,
                _pd: Default::default(),
            }
        }
    }
    pub struct CpIter<'a, R: BufRead + 'a, T> {
        r: &'a mut CpReader<R>,
        n: usize,
        _pd: std::marker::PhantomData<fn() -> T>,
    }
    impl<'a, R: BufRead, T: CpIn> Iterator for CpIter<'a, R, T> {
        type Item = T;
        fn next(&mut self) -> Option<T> {
            if self.n == 0 {
                None
            } else {
                self.n -= 1;
                Some(self.r.read())
            }
        }
    }

    pub trait CpIn {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self;
    }

    impl CpIn for u64 {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            read_u64_fast(&mut r.r)
        }
    }
    impl CpIn for i64 {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            read_i64_fast(&mut r.r)
        }
    }
    impl CpIn for char {
        fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
            let b = r.r.fill_buf().unwrap()[0] as char;
            r.r.consume(1);
            let s = r.r.fill_buf().unwrap()[0];
            assert!(s == b' ' || s == b'\n');
            r.r.consume(1);
            b
        }
    }

    macro_rules! cpin_tuple {
        ($($t:ident),*) => {
            impl<$($t: CpIn),*> CpIn for ($($t),*) {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    ($($t::read_from(r)),*)
                }
            }
        };
    }

    macro_rules! cpin_cast {
        ($t_self:ty, $t_read:ty) => {
            impl CpIn for $t_self {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    <$t_read>::read_from(r) as $t_self
                }
            }
        };
    }
    macro_rules! cpin_parse {
        ($t:ty) => {
            impl CpIn for $t {
                fn read_from<R: BufRead>(r: &mut CpReader<R>) -> Self {
                    r.read_word_str().parse().unwrap()
                }
            }
        };
    }
    cpin_cast!(usize, u64);
    cpin_cast!(u32, u64);
    cpin_cast!(u16, u64);
    cpin_cast!(i32, i64);
    cpin_cast!(i16, i64);
    cpin_cast!(i8, i64);

    cpin_parse!(f64);

    cpin_tuple!(T1, T2);
    cpin_tuple!(T1, T2, T3);
    cpin_tuple!(T1, T2, T3, T4);
    cpin_tuple!(T1, T2, T3, T4, T5);

    fn read_u64_fast<R: BufRead>(r: &mut R) -> u64 {
        let mut value = 0;
        loop {
            let mut idx = 0;
            let buf_len;
            {
                let buf = r.fill_buf().unwrap();
                buf_len = buf.len();
                assert!(buf_len != 0);
                while idx < buf_len && b'0' <= buf[idx] && buf[idx] <= b'9' {
                    value = value * 10 + (buf[idx] - b'0') as u64;
                    idx += 1;
                }
            }
            if idx < buf_len {
                r.consume(idx);
                consume_ws(r);
                return value;
            }
            r.consume(idx);
        }
    }
    fn read_i64_fast<R: BufRead>(r: &mut R) -> i64 {
        let (consume, sign) = match r.fill_buf().unwrap()[0] {
            b'+' => (true, 1),
            b'-' => (true, -1),
            _ => (false, 1),
        };
        if consume {
            r.consume(1);
        }
        read_u64_fast(r) as i64 * sign
    }
    fn consume_ws<R: BufRead>(r: &mut R) {
        let mut c = 0;
        loop {
            r.consume(c);
            let b = r.fill_buf().unwrap();
            if b.len() == 0 {
                return;
            }
            if let Some(p) = b.iter().position(|&x| !x.is_ascii_whitespace()) {
                c = p;
                break;
            }
            c = b.len();
        }
        r.consume(c);
    }

}

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 get_class(x: usize) -> usize {
    let classes = [0usize, 2, 3, 1];
    return classes.iter().position(|&v| v == (x % 4)).unwrap();
}

fn _main() {
    let mut scan = Scan::new();
    let x: usize = scan.next();
    let mut maxclass = get_class(x);
    let mut maxb = 0;
    for &step in [1usize, 2].iter() {
        let current_class = get_class(x + step);
        if current_class > maxclass {
            maxclass = current_class;
            maxb = step;
        }
    }
    println!("{} {}", maxb, ['D', 'C', 'B', 'A'][maxclass]);
}

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