use std::io;

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

    let mut line = String::new();
    stdin::read_line(&mut line);

    let parsed: usize = line.parse().unwrap();

    if parsed & 1 == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

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

    let mut line = String::new();
    stdin.read_line(&mut line);

    let parsed: usize = line.parse().unwrap();

    if parsed & 1 == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

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

    let mut line = String::new();
    stdin.read_line(&mut line);

    let parsed: usize = line.trim().parse().unwrap();

    if parsed & 1 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

fn main() {
    let mut stdin  = io::stdin();
    let mut stdout = io::stdout();

    let mut weight_string = String::new();
    stdin.read_to_string(&mut weight_string).unwrap();

    let weight = weight_string.trim_end().parse::<i32>().unwrap();

    if weight % 2 == 0 {
        stdout.write_all(b"YES\n").unwrap();
    }
    else {
        stdout.write_all(b"NO\n").unwrap();
    }
}


use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = String::with_capacity(10);
    let _ = stdin.read_line(&mut s);

    let n = s.trim().parse::<u8>().unwrap();

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


use std::io;

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

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


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

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

    let input: u32 = input.trim().parse().expect("Not an integer");

    if input % 2 == 0 && input >= 2 {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;
fn main() {

	let mut guess = String::new();

	io::stdin()
		.read_line(&mut guess)

		.expect("failed to read line");
		// Convert the string input into int32
	//let guess: i32 = guess.trim().parse().expect("invalid input");
	//let guess =guess.trim().parse::<i32>().expect("invalid input");
		if let Ok(guess) = guess.trim().parse::<i32>(){

		if (guess % 2) == 0 {
			println!("YES");

		}
		else{

	println!("NO" );}
}}


use std::io;

fn main() {
    let mut n = String::new();
    io::stdin()
        .read_line(&mut n)
        .expect("Ошибка при чтении строки");
    let n: u32 = match n.trim().parse() {
        Ok(num) => num,
        Err(_) => return
    };
    match n & 1 == 0 {
        true => println!("YES"),
        false => println!("NO")
    }
}


use std::io;

fn main() {
    let mut n = String::new();
    io::stdin()
        .read_line(&mut n)
        .expect("Ошибка при чтении строки");
    let n: u32 = match n.trim().parse() {
        Ok(num) => num,
        Err(_) => return
    };
    match n & 2 == 0 && n != 2 {
        true => println!("YES"),
        false => println!("NO")
    }
}


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

let _melon = melon
                .trim()
                .parse::<u32>().unwrap();
if melon % 2 == 0 {
    if melon != 2 {
        println!("YES");
    }
    else {
        println!("NO");
    }
}
else {
    println!("NO");
}
}


use std::io;

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

    let val: u32 = val.trim().parse().unwrap();

    let output = if val % 2 == 0 {
        "YES"
    } else {
        "NO"
    };

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


use std::io;
fn main() {
    let mut N = String::new();
    io::stdin().read_line(&mut N).ok();
    let N: i32 = N.trim().parse();
    if  N % 2 == 0 && N > 2{
        println !("YES");
    }else{
            println!("NO");
         }
}


use std::io;

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

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

let w: i32 = w.trim().parse().unwrap();

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

}


use std::io;

fn main() {
    let mut weight_string = String::new();
    io::stdin().read_line(&mut weight_string).unwrap();
    let weight = weight_string.trim().parse::<u32>().unwrap();

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


use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let num: i32 = input.trim().parse().unwrap();
    let mut ans: bool = false;

    for i in 0..num {
        if i % 2 == 0 && (num - i) % 2 == 0 && (num - i) > 0{
            ans = true;
        }
    }
    if ans == true {
        println!("YES")

    } else {
        println!("NO")
    }
}


extern crate utils;
use std::io;
use utils::*;

pub fn read_line() -> String {
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("error: unable to read user input");
    input[0..input.len() - 1].to_string()
}

fn main() {
    let input = read_line().parse::<i32>().unwrap();
    if input <= 2 {
        println!("NO");
    } else if input % 2 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

fn main() {
    let mut input = String::default();
    io::stdin().read_line(&mut input).unwrap();
    let val = input.parse::<i32>().unwrap();
    if val % 2 == 0 {
        print!("YES");
    } else {
        print!("NO");
    }
}


use std::io;

fn main() {
    let mut input = String::default();
    io::stdin().read_line(&mut input).unwrap();
    let val = input.trim().parse::<i32>().unwrap();
    if val % 2 == 0 {
        print!("YES");
    } else {
        print!("NO");
    }
}


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 n = scan.next::<u64>();

    writeln!(out, "{}", if n % 2 == 0 { "YES" } else { "NO" } ).expect("fail");
}


use std::io::{self, prelude::*};
use std::str;

#[allow(unused_must_use)]
fn run<B: BufRead, W: Write>(mut reader: Scanner<B>, mut writer: W) {
    let weight: i64 = reader.token();
    if weight & 1 != 0 {
        writeln!(writer, "NO");
        return;
    }

    if weight >> 1 & 1 == 0 {
        writeln!(writer, "YES");
    } else {
        writeln!(writer, "NO");
    }
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();

    let reader = Scanner::new(stdin.lock());
    let writer = io::BufWriter::new(stdout.lock());
    run(reader, writer);
}

pub struct Scanner<B> {
    reader: B,
    buffer_string: Vec<u8>,
    buffer_iterator: str::SplitWhitespace<'static>,
}

impl <B: BufRead> Scanner<B> {
    pub fn new(reader: B) -> Self {
        return Self {
            reader,
            buffer_string: Vec::new(),
            buffer_iterator: "".split_whitespace()
        };
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            //if buffer already exists, just use existing buffer
            if let Some(token) = self.buffer_iterator.next() {
                return token.parse().ok().expect("Fail to parse token");
            }

            //get new line
            self.buffer_string.clear();
            self.reader.read_until(b'\n', &mut self.buffer_string).expect("Failed to read");

            //split by white space
            self.buffer_iterator = unsafe {
                let slice = str::from_utf8_unchecked(&self.buffer_string);
                std::mem::transmute(slice.split_whitespace())
            };
        }
    }
}


use std::io::stdin;

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

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

    if n >= 1 && n <= 100 {
        if n % 2 == 0 {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}


//! http://codeforces.com/problemset/problem/4/A

#[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!(n: u32);
  println!("{}", if n % 2 == 0 && (n / 2) % 2 == 0 { "YES" } else { "NO" });
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

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

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

    if n % 2 == 0 {
        puts!("{}\n", "YES");
    } else {
        puts!("{}\n", "NO");
    }
}

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


use std::io;

fn main() {
    let mut weight = String::new();
    io::stdin()
       .read_line(&mut weight)
       .expect("Failed to read line");
    let weight: u32 = weight.trim().parse().expect("Please type a number");
    let limit: u32 = weight / 2;
    let mut x = 2;
    while x <= limit {
        let newweight = weight - x;
        if newweight % 2 == 0 {
            println!("YES");
            break;
        }
        x = x + 2;
    }
}


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

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

    if input.parse::<i32>().unwrap() % 2 == 0 {
    	io::stdout().write_all(b"YES").unwrap();
    } else {
    	io::stdout().write_all(b"NO").unwrap();
    }
}


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

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

	let n = s.trim().parse::<i32>().unwrap();

    if n & 2 == 0 && n != 2 {
    	println!("YES");
    }
    } else {
    	println!("NO");
    }
}


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

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

	let n = s.trim().parse::<i32>().unwrap();

    if n & 2 == 0 && n != 2 {
    	println!("YES");
    } else {
    	println!("NO");
    }
}


use std::io::prelude::*;
use std::io::BufReader;
#[allow(unused_imports)]
use std::fs::File;

struct Scanner<T: Read> {
	lines: std::io::Lines<BufReader<T>>
}
impl<T: Read> Scanner<T> {
	fn new(source: T) -> Scanner<T> {
		Scanner {
			lines: BufReader::new(source).lines()
		}
	}
	fn read_line(&mut self) -> String { self.lines.next().unwrap().unwrap() }
}
fn main() {
	let mut input = Scanner::new(std::io::stdin());
	let n: usize = input.read_line().parse().unwrap();
	println!("{}", if n > 4 && n % 2 == 0 { "YES" } else { "NO" });
}


use std::io;

fn main() {

    let mut weight = String::new();

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

    let trimmed = weight.trim();
    match trimmed.parse::<u8>() {
        Ok(i) => if i%2 == 0 {
            println!("YES");
        } else {
            println!("NO")
        }
        Err(..) => println!("this was not an integer: {}", trimmed),
    }

}


use std::io;

fn solve(val: u32) -> bool {
    val % 4 == 0
}

fn main() {
    let stdin = io::stdin();
    let mut line = String::new();
    let _ = stdin.read_line(&mut line);
    let line = line.trim();
    match line.parse::<u32>() {
        Ok(val) => {
            if solve(val) {
                println!("YES");
            } else {
                println!("NO");
            }
        },
        Err(_) => ()
    }
}


#![allow(unused_imports)]
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 n = scan.next::<i32>();
  if n % 2 == 0 {
    writeln!(out, "YES").ok();
  } else {
    writeln!(out, "NO").ok();
  }
}


use std::io::stdin;

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

    if n > 3 && n % 2 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

    let weight = line.trim().parse::<i32>().expect("Error parse int");

    if weight != 2 && weight % 2 == 0 {
        println!("TRUE");
    } else {
        println!("FALSE");
    }
}


use std::io;

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

    io::stdin()
        .read_line(&mut input)
        .expect("failed to read line");

    let n: i32 = match input.trim().parse() {
        Ok(value) => value,
        Err(_) => -1,
    };

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


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

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

    io::stdin().read_line(&mut line).expect("Failed to read!");

    let x: u32 = line.trim().parse().expect("Not integer!");

    let possible = x % 2 == 0;

    if possible {
        print!("YES");
    } else {
        print!("NO");
    }
    io::stdout().flush().expect("Failed to flush!");
}


/*! https://codeforces.com/problemset/problem/4/A
注意在IDEA上发送EOF的快捷键是cmd+d
*/
use std::io::BufRead;

fn main() {
    let mut input: Vec<String> = Vec::with_capacity(1);
    for line in std::io::stdin().lock().lines() {
        if let Ok(str) = line {
            input.push(str);
            break;
        }
    }
    // parse first line of stdin
    let num = input[0].parse::<u8>().unwrap();
    if num % 2 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


/*! https://codeforces.com/problemset/problem/4/A
注意在IDEA上发送EOF的快捷键是cmd+d

本题问的是一个数能否被分成两个偶数之和，显然只要大于2的偶数都复合条件
*/
use std::io::Read;

fn main() {
    let mut input;
    std::io::stdin().lock().read_to_string(&mut input);
    let num = input[0].parse::<u8>().unwrap();
    if num > 2 && num % 2 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


/*! https://codeforces.com/problemset/problem/4/A
注意在IDEA上发送EOF的快捷键是cmd+d

本题问的是一个数能否被分成两个偶数之和，显然只要大于2的偶数都复合条件
*/
use std::io::Read;

fn main() {
    let mut input = String::with_capacity(3);
    std::io::stdin().lock().read_to_string(&mut input).unwrap();
    // the range of num is [0, 100]
    let num = input.parse::<u8>().unwrap();
    if num > 2 && num % 2 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


/*! https://codeforces.com/problemset/problem/4/A
注意在IDEA上发送EOF的快捷键是cmd+d，本题的测试用例1是 8+回车+EOF

本题问的是一个数能否被分成两个偶数之和，显然只要不等于2的所有偶数都符合条件
*/
use std::io::Read;

const ASCII_0: u8 = b'0';

fn main() {
    // max input len testcase is "100\n"([49,48,48,10])
    let mut input = [0u8; 4];
    let input_size = std::io::stdin().lock().read(&mut input).unwrap();
    // The first (and the only) input line contains integer number w (1≤w≤100)
    let mut num = 0u8;
    for i in 0..input_size-1 {
        let digit = input[i] - ASCII_0;
        num = num * 10 + digit;
    }
    dbg!(num, input_size);
    println!("input: {:?}, num: {}, input_size: {}", input, num, input_size);
    if num % 2 == 0 && num != 2 {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

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

    let num: i32 = input.parse().unwrap();

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


use std::io;

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

    let num: i32 = input.trim().parse().unwrap();

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


macro_rules! read {
	() => { read!("") };
	($msg:expr) => {{
		use std::io::Write;
		print!("{}", $msg);
		std::io::stdout().flush().unwrap();
		std::str::FromStr::from_str(&read_word()).unwrap()
	}};
}

pub fn read_word() -> String {
	use std::io::prelude::*;
	let mut word: Vec<u8> = vec![];

	for c in ::std::io::stdin().bytes() {
		let c = c.unwrap();
		if (c as char).is_whitespace() {
			if !word.is_empty() {
				break;
			}
		} else {
			word.push(c);
		}
	}
	::std::str::from_utf8(&word).unwrap().to_string()
}

fn main() {
	let w: i8 = read!();
	if w % 2 == 0 {
		println!("YES");
	} else {
		println!("NO");
	}
}


fn main(){
    let mut line=String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let control=['h','e','l','l','o'];
    let mut line:Vec<char>=line
        .trim()
        .chars()
        .filter(|c|match c{
            'h'=>true,
            'e'=>true,
            'l'=>true,
            'o'=>true,
            _=>false,
        })
        .collect();
    let len=line.len();
    let mut stop:usize=0;
    'control:for c in 0..5{
                for l in stop..len{
                    if control[c]==line[l]{
                        stop=l+1;
                        continue'control
                    }
                    if c<5 && l==len-1{print!("NO");return}
                }
            }
    print!("YES")
}


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

pub struct Scanner<U: Sized + Read> {
    pub buffer: Vec<String>,
    pub reader: U,
}
impl<U: Sized + Read> Scanner<U> {
    pub 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();
            self.reader.read_to_string(&mut input).expect("Failed read");
            self.buffer = input.lines().rev().map(String::from).collect();
        }
    }

    pub fn new(reader: U) -> Self {
        return Scanner {
            buffer: vec![],
            reader,
        };
    }
}
pub fn solution_of_p58a(input: &mut Read, out: &mut Write) {
    let mut scanner = Scanner::new(input);
    let line1 = scanner.next::<String>();
    if contains_hello(line1) {
        write!(out, "YES").ok();
    } else {
        write!(out, "NO").ok();
    }
}

fn contains_hello(s: String) -> bool {
    let word = "hello";
    if s == word {
        return false;
    }
    let mut ss = &s[0..];
    for c in word.chars() {
        if let Some(cur_pos) = ss.find(c) {
            ss = &ss[cur_pos+1..];
        } else {
            return false;
        }
    }
    return true;
}

fn main() {
    solution_of_p58a(&mut stdin(), &mut stdout());
}


#![allow(non_snake_case, unused_imports, deprecated, dead_code)]

// Input macros
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{VecDeque,HashMap,HashSet,BTreeMap,BTreeSet,BinaryHeap};
// Module for v1.15.1
use std::ascii::AsciiExt; // deprecated since 1.26.0: use inherent method instead

// Functions

// Main
fn main() {

    input! {
        S: String,
    }

    let hello = vec!['h','e','l','l','o'];

    let mut i = 0;
    for c in S.chars() {
        if c==hello[i] {
            i += 1;
        }
        if i==5 {
            break;
        }
    }

    println!("{}", if i==5{"YES"else{"NO"}});
}


// Author: Xu Zhao (i@xuzhao.net)
// Date: Nov 23, 2016

//! Codeforces Problem 58A
use std::io::{self, BufRead};

const word:[char; 5] = ['h', 'e', 'l', 'l', 'o'];

fn check(line: String, i: usize, j: usize) -> bool {
  if i == line.len() {
    return false;
  } else if j == word.len() {
    return true;
  }
  if line.chars().nth(i).unwrap() == word[j] {
    return check(line, i + 1, j + 1);
  } else {
    return check(line, i + 1, j);
  }
}

fn main() {
  let stdin = io::stdin();
  for line in stdin.lock().lines() {
    let s = line.unwrap();
    if check(s, 0, 0) {
      println!("YES");
    } else {
      println!("NO");
    }
    return;
  }
}


use std::io;

fn main() -> io::Result<()> {
    let mut s = String::new();
    let stdin = io::stdin();

    let _ = stdin.read_line(&mut s)?;
    s = s.trim().to_string();

    let word = "hello";
    if calc(word, &s) {
        println!("YES");
    } else {
        println!("NO");
    }

    Ok(())
}

fn calc(sub: &str, s: &str) -> bool {
    calc2(sub.as_bytes(), s.as_bytes())
}

fn calc2<'a, T>(sub: T, s: T) -> bool
where
    T: IntoIterator<Item = &'a u8>,
    T::IntoIter: Clone
{
    let mut sub_iter = sub.into_iter();
    let mut s_iter = s.into_iter();

    while let Some(c) = sub_iter.next() {
        if let Some(c2) = s_iter.next() {
            if c == c2 {
                if calc2(sub_iter.clone(), s_iter.clone()) {
                    return true;
                } else {
                    continue;
                }
            }
        }
        return false
    }

    true
}


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

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

use std::io::Write;

fn solve(writer: &mut std::io::BufWriter<std::io::Stdout>) {
    let n = parse_line!(usize);
    let ok = n == 1;
    writeln!(writer, "{}", if ok {"Ehab"} else {"Mahmoud"}).unwrap();
}

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


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

fn main() {
	let mut b = String::new();
	io::stdin().read_to_string(&mut b);
	let mut inp = b.split_whitespace();
	let x = inp.next().unwrap().parse::<i32>().unwrap() as f32;
	let y = inp.next().unwrap().parse::<i32>().unwrap() as f32;
	let z = inp.next().unwrap().parse::<i32>().unwrap() as f32;
	let t = ((x+y+z)/3.0).round();

    print!("{}", (x-t).abs()+(y-t).abs()+(z-t).abs());
}


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

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

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

}

fn _main() {
    let mut scan = Scan::new();
    let a: isize = scan.next();
    let b: isize = scan.next();
    let c: isize = scan.next();
    if a==b {
        println!("{}", (a-c).abs());
    } else if a==c || b==c {
        println!("{}", (a-b).abs());
    } else {
        let middle: isize = (a + b + c) / 3;
        let result = (a-middle).abs() + (b-middle).abs() + (c-middle).abs();
        println!("{}", result);
    }
}

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


use std::io::Read;

fn input(read_file: bool) -> String {
    if read_file {
        let mut file = std::fs::File::open("sample.txt").unwrap();
        let mut buf = String::new();
        file.read_to_string(&mut buf).unwrap();
        buf
    } else {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        buf.trim_end().to_owned()
    }
}

fn solve(ws: &mut std::str::SplitWhitespace) {
    let _: usize = ws.next().unwrap().parse().unwrap();
    let s: Vec<char> = ws.next().unwrap().to_string().chars().collect();

    let mut m = std::collections::HashMap::new();
    m.insert(2, "2");
    m.insert(3, "3");
    m.insert(4, "223");
    m.insert(5, "5");
    m.insert(6, "35");
    m.insert(7, "7");
    m.insert(8, "2227");
    m.insert(9, "9");

    let mut ans: Vec<char> = Vec::new();
    for c in s {
        let d = c as i32 - '0' as i32;
        let mut x: Vec<char> = m.entry(d).or_default().chars().collect();
        ans.append(&mut x);
    }

    ans.sort();
    ans.reverse();
    let s: String = ans.iter().collect();
    println!("{}", s);
}

fn main() {
    const READ_FROM_FILE: bool = true;

    let s = input(READ_FROM_FILE);
    let mut ws = s.split_whitespace();

    solve(&mut ws);
}


use std::io::Read;

fn input(read_file: bool) -> String {
    if read_file {
        let mut file = std::fs::File::open("sample.txt").unwrap();
        let mut buf = String::new();
        file.read_to_string(&mut buf).unwrap();
        buf
    } else {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        buf.trim_end().to_owned()
    }
}

fn solve(ws: &mut std::str::SplitWhitespace) {
    let _: usize = ws.next().unwrap().parse().unwrap();
    let s: Vec<char> = ws.next().unwrap().to_string().chars().collect();

    let mut m = std::collections::HashMap::new();
    m.insert(2, "2");
    m.insert(3, "3");
    m.insert(4, "223");
    m.insert(5, "5");
    m.insert(6, "35");
    m.insert(7, "7");
    m.insert(8, "2227");
    m.insert(9, "9");

    let mut ans: Vec<char> = Vec::new();
    for c in s {
        let d = c as i32 - '0' as i32;
        let mut x: Vec<char> = m.entry(d).or_default().chars().collect();
        ans.append(&mut x);
    }

    ans.sort();
    ans.reverse();
    let s: String = ans.iter().collect();
    println!("{}", s);
}

fn main() {
    const READ_FROM_FILE: bool = false;

    let s = input(READ_FROM_FILE);
    let mut ws = s.split_whitespace();

    solve(&mut ws);
}


#![allow(unused_imports)]

use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use std::io::{stdin, stdout, BufWriter, 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();
        }
    }
}

use std::collections::*;

fn solve () {
    let mut scan = Scanner::default();
    let n: usize = scan.next();
    let a: String = scan.next();
    let v = vec![
        "",
        "",
        "2",
        "3",
        "223",
        "5",
        "35",
        "7",
        "222",
        "2337",
    ];
    let mut res = String::new ();
    for x in a.chars() {
        res.push_str (v[x.to_digit(10).unwrap() as usize]);
    }
    let mut v: Vec<char> = res.chars().collect();
    v.sort();
    v.reverse();
    for x in v {
        print! ("{}", x);
    }
}

fn main() {
    let mut scan = Scanner::default();
    // let t = scan.next::<u64>();
    let t = 1;
    for _ in 0..t {
        solve();
    }
}


fn main() {
    let mut text = String::new();
    std::io::stdin().read_line(&mut text).expect("");
    let n = text.trim().parse::<i64>().expect("");

    if n > 1 && n % 2 == 1 {
        println!("1 {}", (n - 3) / 2)
    } else {
        println!("NO")
    }
}


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

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

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

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

fn find_xy(r: i64) -> Option<(i64, i64)> {
    let mut x = 1;
    while x * x <= r {
        if (r - x * x - x - 1) % (2 * x) == 0 {
            let y = (r - x * x - x - 1) / (2 * x);
            return Some((x, y));
        }
        x += 1;
    }
    None
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let r: i64 = scan.token();
    match find_xy(r) {
        Some((x, y)) => writeln!(out, "{} {}", x, y).ok(),
        None => writeln!(out, "NO").ok(),
    };
}

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


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

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

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

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

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

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

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

trait Ext {
    fn is_odd(&self) -> bool;
    fn is_even(&self) -> bool;
}

impl Ext for i32 {
    #[inline]
    fn is_odd(&self) -> bool {
        self % 2 != 0
    }

    #[inline]
    fn is_even(&self) -> bool {
        self % 2 == 0
    }
}

fn main() {
    let (n,) = scan_line!(usize);
    let array = scan_line_to_vec!(i32);

    let mut result = true;

    let mut i = 0;
    let mut segment_count = 0;
    let mut count_evens = 0;

    while i < (n - 1) {
        if array[i].is_odd() && array[i+1].is_odd() {
            segment_count += 1;
        } else if array[i].is_odd() && array[i+1].is_even() {
            count_evens += 1;
        } else if array[i].is_even() && array[i+1].is_even() {
            count_evens += 1;
        } else if array[i].is_even() && array[i+1].is_odd() {
            if count_evens.is_odd() {
                count_evens = 0;
                segment_count += 1;
                i += 1;
            } else {
                result = false;
                break;
            }
        }
        i += 1;
    }

    if i == n - 1 && array[n - 1].is_odd() {
        segment_count += 1;
    } else if i == n - 1 {
        result = false;
    }

    if segment_count.is_even() {
        result = false;
    }

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


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

fn get_max_delta<T>(values: &Vec<T>) -> Option<(T, usize, usize)>
where
    T: Ord,
    T: Copy,
    T: std::ops::Sub<Output = T>,
{
    if values.len() <= 1 {
        return None;
    }

    let mut min_positions: Vec<usize> = Vec::new();
    let mut max_positions: Vec<usize> = Vec::new();

    min_positions.push(0);
    max_positions.push(0);

    for i in 1..(values.len() - 1) {
        let value = values[i];
        let prev_value = values[i - 1];
        let next_value = values[i + 1];

        if (value >= prev_value) && (value >= next_value) {
            max_positions.push(i);
        }
        if (value <= prev_value) && (value <= next_value) {
            min_positions.push(i);
        }
    }

    min_positions.push(values.len() - 1);
    max_positions.push(values.len() - 1);

    let mut max_delta: Option<(T, usize, usize)> = None;
    let mut max_position_index: usize = 0;

    for i in 0..min_positions.len() {
        let min_position = min_positions[i];
        let min_position_value = values[min_position];
        while max_positions[max_position_index] <= min_positions[i] {
            max_position_index += 1;
            if max_position_index >= max_positions.len() {
                break;
            }
        }
        if max_position_index >= max_positions.len() {
            break;
        }
        for j in max_position_index..max_positions.len() {
            let max_position = max_positions[j];
            let max_position_value = values[max_position];
            let delta_value = max_position_value - min_position_value;
            if let Some((max_delta_value, _max_delta_start, _max_delta_end)) = max_delta {
                if delta_value > max_delta_value {
                    max_delta = Some((delta_value, min_position, max_position));
                }
            } else {
                max_delta = Some((delta_value, min_position, max_position));
            }
        }
    }

    return max_delta;
}

fn get_best_score(values: &Vec<u8>) -> usize {
    let mut switch_scores: Vec<isize> = Vec::with_capacity(values.len());
    let mut current_switch_score: isize = 0;
    let mut base_score: usize = 0;
    for &value in values {
        if value == 0 {
            current_switch_score += 1;
        } else {
            current_switch_score -= 1;
            base_score += 1;
        }
        switch_scores.push(current_switch_score);
    }

    let (max_switch_score, _, _) = get_max_delta(&switch_scores).unwrap();

    return ((base_score as isize) + max_switch_score) as usize;
}

#[cfg(test)]
mod tests {
    use super::{get_best_score, get_max_delta};

    #[test]
    fn test_get_best_score_1() {
        assert_eq!(get_best_score(&vec![1, 0, 0, 1, 0]), 4);
    }
    #[test]
    fn test_get_best_score_2() {
        assert_eq!(get_best_score(&vec![1, 0, 0, 1]), 4);
    }
    #[test]
    fn test_get_best_score_3() {
        assert_eq!(get_best_score(&vec![1, 0, 1, 0, 1, 0]), 4);
    }

    fn do_test_max_delta(values: &Vec<i32>) {
        if values.len() <= 1 {
            assert_eq!(get_max_delta(values), None);
            return;
        }

        let mut max_delta: i32 = 0;
        for i in 0..values.len() {
            for j in (i + 1)..values.len() {
                let delta: i32 = values[j] - values[i];
                if delta > max_delta {
                    max_delta = delta;
                }
            }
        }

        let (result_max_delta, result_start, result_end) = get_max_delta(values).unwrap();
        assert_eq!(result_max_delta, max_delta);
        assert_eq!(values[result_end] - values[result_start], max_delta);
    }

    #[test]
    fn test_get_max_delta_1() {
        do_test_max_delta(&vec![1, 2, 7, 19, 20, 3, 0, -4, 4]);
    }
    #[test]
    fn test_get_max_delta_2() {
        do_test_max_delta(&vec![0, 0, 0, 3]);
    }
    #[test]
    fn test_get_max_delta_3() {
        do_test_max_delta(&vec![1]);
    }
}

fn main() {
    let stdin = stdin();
    let mut stdin_lock = stdin.lock();

    {
        let mut skip_buffer = String::new();
        stdin_lock.read_line(&mut skip_buffer).unwrap();
    }
    let mut string_buffer = String::new();
    stdin_lock.read_line(&mut string_buffer).unwrap();
    let values: Vec<u8> = string_buffer
        .trim()
        .split_whitespace()
        .map(|s| s.parse::<u8>().unwrap())
        .collect();

    let best_score: usize = get_best_score(&values);
    println!("{}", best_score);
}


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

fn get_max_delta<T>(values: &Vec<T>) -> Option<(T, usize, usize)>
where
    T: Ord,
    T: Copy,
    T: std::ops::Sub<Output = T>,
{
    if values.len() <= 1 {
        return None;
    }

    let mut min_positions: Vec<usize> = Vec::new();
    let mut max_positions: Vec<usize> = Vec::new();

    min_positions.push(0);
    max_positions.push(0);

    for i in 1..(values.len() - 1) {
        let value = values[i];
        let prev_value = values[i - 1];
        let next_value = values[i + 1];

        if (value >= prev_value) && (value >= next_value) {
            max_positions.push(i);
        }
        if (value <= prev_value) && (value <= next_value) {
            min_positions.push(i);
        }
    }

    min_positions.push(values.len() - 1);
    max_positions.push(values.len() - 1);

    let mut max_delta: Option<(T, usize, usize)> = None;
    let mut max_position_index: usize = 0;

    for i in 0..min_positions.len() {
        let min_position = min_positions[i];
        let min_position_value = values[min_position];
        while max_positions[max_position_index] <= min_positions[i] {
            max_position_index += 1;
            if max_position_index >= max_positions.len() {
                break;
            }
        }
        if max_position_index >= max_positions.len() {
            break;
        }
        for j in max_position_index..max_positions.len() {
            let max_position = max_positions[j];
            let max_position_value = values[max_position];
            let delta_value = max_position_value - min_position_value;
            if let Some((max_delta_value, _max_delta_start, _max_delta_end)) = max_delta {
                if delta_value > max_delta_value {
                    max_delta = Some((delta_value, min_position, max_position));
                }
            } else {
                max_delta = Some((delta_value, min_position, max_position));
            }
        }
    }

    return max_delta;
}

fn get_best_score(values: &Vec<u8>) -> usize {
    let mut switch_scores: Vec<isize> = Vec::with_capacity(values.len() + 1);
    switch_scores.push(0);
    let mut current_switch_score: isize = 0;
    let mut base_score: usize = 0;
    for &value in values {
        if value == 0 {
            current_switch_score += 1;
        } else {
            current_switch_score -= 1;
            base_score += 1;
        }
        switch_scores.push(current_switch_score);
    }

    let (max_switch_score, _, _) = get_max_delta(&switch_scores).unwrap();

    return ((base_score as isize) + max_switch_score) as usize;
}

#[cfg(test)]
mod tests {
    use super::{get_best_score, get_max_delta};

    #[test]
    fn test_get_best_score_1() {
        assert_eq!(get_best_score(&vec![1, 0, 0, 1, 0]), 4);
    }
    #[test]
    fn test_get_best_score_2() {
        assert_eq!(get_best_score(&vec![1, 0, 0, 1]), 4);
    }
    #[test]
    fn test_get_best_score_3() {
        assert_eq!(get_best_score(&vec![1, 0, 1, 0, 1, 0]), 4);
    }
    #[test]
    fn test_get_best_score_4() {
        assert_eq!(get_best_score(&vec![1]), 0);
    }
    #[test]
    fn test_get_best_score_5() {
        assert_eq!(get_best_score(&vec![0]), 1);
    }

    fn do_test_max_delta(values: &Vec<i32>) {
        if values.len() <= 1 {
            assert_eq!(get_max_delta(values), None);
            return;
        }

        let mut max_delta: i32 = 0;
        for i in 0..values.len() {
            for j in (i + 1)..values.len() {
                let delta: i32 = values[j] - values[i];
                if delta > max_delta {
                    max_delta = delta;
                }
            }
        }

        let (result_max_delta, result_start, result_end) = get_max_delta(values).unwrap();
        assert_eq!(result_max_delta, max_delta);
        assert_eq!(values[result_end] - values[result_start], max_delta);
    }

    #[test]
    fn test_get_max_delta_1() {
        do_test_max_delta(&vec![1, 2, 7, 19, 20, 3, 0, -4, 4]);
    }
    #[test]
    fn test_get_max_delta_2() {
        do_test_max_delta(&vec![0, 0, 0, 3]);
    }
    #[test]
    fn test_get_max_delta_3() {
        do_test_max_delta(&vec![1]);
    }
}

fn main() {
    let stdin = stdin();
    let mut stdin_lock = stdin.lock();

    {
        let mut skip_buffer = String::new();
        stdin_lock.read_line(&mut skip_buffer).unwrap();
    }
    let mut string_buffer = String::new();
    stdin_lock.read_line(&mut string_buffer).unwrap();
    let values: Vec<u8> = string_buffer
        .trim()
        .split_whitespace()
        .map(|s| s.parse::<u8>().unwrap())
        .collect();

    let best_score: usize = get_best_score(&values);
    println!("{}", best_score);
}


// 2018-10-12 13:59
fn main() {
    let _ = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    };
    let v: Vec<i32> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim()
            .split(" ")
            .map(|s| s.parse::<i32>().unwrap())
            .collect()
    };

    let n = v.len();
    let orig = v.iter().filter(|&x| *x == 1).count() as i32;

    let mut dp = vec![vec![0; n + 1]; n + 1];
    let mut inc = 0;
    for i in 0..n {
        for j in i + 1..n + 1 {
            dp[i][j] = {
                if v[j - 1] == 0 {
                    dp[i][j - 1] + 1
                } else {
                    dp[i][j - 1]
                }
            };
            inc = std::cmp::max(inc, dp[i][j] * 2 - (j - i) as i32);
        }
    }
    println!("{:?}", inc + orig);
}


fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n : usize = s.trim().parse().unwrap();
    s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let ints:Vec<i32> = s.split_whitespace().map(|x| x.parse().unwrap()).collect();
    let mut onesum : Vec<i32> = vec![0];
    let mut onerevsum : Vec<i32> = vec![0];
    let mut sum = 0;
    let mut revsum = 0;
    let mut newints : Vec<i32> = vec![ints[0]];
    let mut newintscount : Vec<i32> = vec![0];
    let mut lastnum=ints[0];

    for i in 0..n {
        *onesum.last_mut().unwrap() = sum;
        *onerevsum.first_mut().unwrap() = revsum;
        sum+=ints[i];
        revsum+=ints[n-i-1];
        if ints[i] == lastnum {
            *(newintscount.last_mut().unwrap())+=if ints[i]==0 {1} else{0};
        } else {
            onesum.push(0);
            onerevsum.insert(0,0);
            newints.push(ints[i]);
            newintscount.push(if ints[i]==0 {1} else {0});
        }
        lastnum = ints[i];
    }
    *onesum.last_mut().unwrap() = sum;
    *onerevsum.first_mut().unwrap() = revsum;

//    println!("{:?}",newints);
//    println!("{:?}",newintscount);
//    println!("{:?}",onesum);
//    println!("{:?}",onerevsum);

    let mut max = 0;

    for i in 0..(newints.len()) {
        for j in i..(newints.len()) {
            if newints[i] == 0 && newints[j] == 0 {
                let subsum = &newintscount[i..=j].iter().fold(0, |acc, x| acc+x) + onesum[i] + onerevsum[j];
//                println!("slice={:?} sum={}",&newints[i..=j],subsum);
                max = std::cmp::max(max, subsum);
            }
        }
    }
    println!("{}",max);

}


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

struct State(u32, u32);

fn main() {
    input! {
        n: usize,
        a: [u8; n],
    }

    let mut state = State(0, 0);
    let num_of_1 = a.iter().filter(|x| **x == 1).count();

    for x in a {
        state = if x == 1 {
            State(std::cmp::max(state.0, state.1), 0)
        } else {
            State(state.0, state.1 + 1)
        };
    }
    println!("{}", num_of_1 as u32 + state.0);
}


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

}

fn _main() {
    let mut scan = Scan::new();
    let n: usize = scan.next();
    let arr: Vec<isize> = scan.next_n(n);
    let total: isize = arr.iter().sum();
    // convert to an array in which Kadane can be used
    let arr2: Vec<isize> = arr.into_iter().map(|x| if x==1 { -1 } else { 1 }).collect();
    let mut cnt: isize = 0;
    let mut maxcnt: isize = 0;
    for i in 0..n {
        cnt += arr2[i];
        if cnt < 0 { cnt = 0; }
        maxcnt = maxcnt.max(cnt);
    }
    println!("{}", total + maxcnt);
}

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


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

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

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

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

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

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

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

#[derive(Copy, Clone, Debug)]
struct Pair {
    i : usize,
    cost : i64
}
impl PartialOrd for Pair {
    fn partial_cmp(&self, other : &Pair) -> Option<Ordering> {
        Some(self.cost.cmp(&other.cost))
    }
}

impl Ord for Pair {
    fn cmp(&self, other : &Pair) -> Ordering {
        self.partial_cmp(other).unwrap()
    }
}

impl PartialEq for Pair {
    fn eq(&self, other : &Pair) -> bool {
        self.cost == other.cost
    }
}
impl Eq for Pair {}

fn main() {
    let stdin = stdin();
    let mut s = stdin.lock();
    let _ = scan!(s, usize);
    let mut data : Vec<_> = scan_iter!(s, i64);
    let mut i = 0;
    let mut j = data.len() - 1;

    while data[i] == 1 {
        i += 1;
    }
    while data[j] == 1 {
        j -= 1;
    }

    for k in i..(j+1) {
        data[k] = 1 - data[k];
    }
    let result = data.iter().fold(0, |c, x| c + x);

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


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

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

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

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

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

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

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

#[derive(Copy, Clone, Debug)]
struct Pair {
    i : usize,
    cost : i64
}
impl PartialOrd for Pair {
    fn partial_cmp(&self, other : &Pair) -> Option<Ordering> {
        Some(self.cost.cmp(&other.cost))
    }
}

impl Ord for Pair {
    fn cmp(&self, other : &Pair) -> Ordering {
        self.partial_cmp(other).unwrap()
    }
}

impl PartialEq for Pair {
    fn eq(&self, other : &Pair) -> bool {
        self.cost == other.cost
    }
}
impl Eq for Pair {}

fn main() {
    let stdin = stdin();
    let mut s = stdin.lock();
    let _ = scan!(s, usize);
    let mut data : Vec<_> = scan_iter!(s, i64);
    let mut i = 0;
    let mut j = data.len() - 1;

    while i < data.len() && data[i] == 1 {
        i += 1;
    }
    while j > 0 && data[j] == 1 {
        j -= 1;
    }

    for k in i..(j+1) {
        data[k] = 1 - data[k];
    }
    let result = data.iter().fold(0, |c, x| c + x);

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


// 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!(u64);
    let b = split_input!(u64);
    let mut best = 0;
    let mut cur = 0;
    let ones: u64 = b.iter().sum();
    for p in b.iter() {
        if *p == 0 {
            cur += 1;
            best = std::cmp::max(best, cur);
        } else if cur > 0 {
            cur -= 1;
        }
    }

    println!("{}", ones + best);
}


#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::{BTreeMap,BTreeSet};
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! ite {
    ($c:expr, $t:expr, $f:expr) => {{
        if $c { $t } else { $f }
    }};
}

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

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

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

fn prime_factorization(n: i64) -> Vec<(i64,usize)> {
    let mut res = vec![];
    let mut x = n;
    let mut i = 2;
    while i * i <= x {
        let mut count = 0;
        while x % i == 0 {
            count += 1;
            x /= i;
        }
        if count != 0 {
            res.push((i, count));
        }
        i += 1;
    }
    if x != 1 {
        res.push((x,1));
    }
    res
}

fn dfs(ps: &Vec<(i64,usize)>, prim: &Vec<usize>, prev: Mod, res: &mut BTreeMap<i64,Mod>, x: i64, i: usize, total_count: Mod) {
    if i == ps.len() {
        *res.entry(x).or_insert(Mod(0)) += prev / total_count;
        return;
    }
    for k in 0..prim[i]+1 {
        dfs(ps, prim, prev, res, x * ps[i].0.pow(k as u32), i+1, total_count);
    }
}

fn dfs2(ps: &Vec<(i64, usize)>, i: usize, prim: &mut Vec<usize>, prev_map: &BTreeMap<i64,Mod>, new_map: &mut BTreeMap<i64,Mod>, y: i64) {
    if i == ps.len() {
        let mut total_count = Mod(1);
        for k in 0..ps.len() {
            total_count *= Mod(prim[k] as u64) + Mod(1);
        }
        let t = match prev_map.get(&y) {
            Some(t) => *t,
            None => Mod(0),
        };
        dfs(ps, prim, t, new_map, 1, 0, total_count);
        return;
    }
    for k in 0..ps[i].1+1 {
        prim.push(k);
        dfs2(ps, i+1, prim, prev_map, new_map, y * ps[i].0.pow(k as u32));
        prim.pop();
    }
}

fn main() {
    input! {
        n: i64,
        m: usize,
    }
    let ps = prime_factorization(n);
    let mut btree = BTreeMap::new();
    btree.insert(n, Mod(1));
    for _ in 0..m {
        let mut new_btree = BTreeMap::new();
        dfs2(&ps, 0, &mut vec![], &btree, &mut new_btree, 1);
        btree = new_btree;
    }
    let mut res = Mod(0);
    for (&key,&x) in btree.iter() {
        res += Mod(key as u64) * x;
    }
    println!("{}", res.0);
}

use std::ops::*;

const MOD : u64 = 1_000_000_007;
#[derive(Clone,Copy,PartialEq,Debug)]
pub struct Mod (pub u64);

impl Mod {
    pub fn pow(self, n: u64) -> Mod {
        if n == 0 {
            return Mod(1);
        }
        let t = self.pow(n/2);
        if n % 2 == 0 {
            t * t
        }
        else {
            t * t * self
        }
    }
}

impl Add for Mod {
    type Output = Self;
    fn add(self, rhs: Self) -> Self::Output {
        Mod((self.0 + rhs.0) % MOD)
    }
}

impl AddAssign for Mod {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

impl Sub for Mod {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self::Output {
        Mod((self.0 + MOD - rhs.0 % MOD) % MOD)
    }
}

impl SubAssign for Mod {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs;
    }
}

impl Neg for Mod {
    type Output = Mod;
    fn neg(self) -> Mod {
        Mod(MOD - self.0)
    }
}

impl Mul for Mod {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self::Output {
        Mod(self.0 % MOD * rhs.0 % MOD)
    }
}

impl MulAssign for Mod {
    fn mul_assign(&mut self, rhs: Self) {
        *self = *self * rhs;
    }
}

impl Div for Mod {
    type Output = Self;
    fn div(self, rhs: Self) -> Self::Output {
        self * rhs.pow(MOD-2)
    }
}

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

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

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

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

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!();
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!();
}


#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::{BTreeMap,BTreeSet};
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! ite {
    ($c:expr, $t:expr, $f:expr) => {{
        if $c { $t } else { $f }
    }};
}

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

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

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

fn prime_factorization(n: i64) -> Vec<(i64,usize)> {
    let mut res = vec![];
    let mut x = n;
    let mut i = 2;
    while i * i <= x {
        let mut count = 0;
        while x % i == 0 {
            count += 1;
            x /= i;
        }
        if count != 0 {
            res.push((i, count));
        }
        i += 1;
    }
    if x != 1 {
        res.push((x,1));
    }
    res
}

fn dfs(ps: &Vec<(i64,usize)>, table: &Vec<Vec<Mod>>, i: usize, x: i64, prob: Mod) -> Mod {
    if i == ps.len() {
        return prob * Mod(x as u64);
    }
    let mut res = Mod(0);
    for k in 0..ps[i].1+1 {
        res += dfs(ps, table, i+1, x * ps[i].0.pow(k as u32), prob * table[i][k]);
    }
    res
}

fn main() {
    input! {
        n: i64,
        m: u64,
    }
    let ps = prime_factorization(n);

    let mut inv_table = vec![Mod(1), Mod(1)];
    for i in 2..1000 {
        inv_table.push(Mod(1) / Mod(i));
    }

    let mut table = vec![];
    for &(p,count) in &ps {
        let mut dp = vec![Mod(0); count+1];
        dp[count] = Mod(1);
        for _ in 0..m {
            let mut dp2 = vec![Mod(0); count+1];
            for j in 0..count+1 {
                for k in 0..j+1 {
                    // dp2[k] += dp[j] / Mod((j+1) as u64);
                    dp2[k] += dp[j] * inv_table[j+1];
                }
            }
            dp = dp2;
        }
        table.push(dp);
    }

    let res = dfs(&ps, &table, 0, 1, Mod(1));
    println!("{}", res.0);
}

use std::ops::*;

const MOD : u64 = 1_000_000_007;
#[derive(Clone,Copy,PartialEq,Debug)]
pub struct Mod (pub u64);

impl Mod {
    pub fn pow(self, n: u64) -> Mod {
        if n == 0 {
            return Mod(1);
        }
        let t = self.pow(n/2);
        if n % 2 == 0 {
            t * t
        }
        else {
            t * t * self
        }
    }
}

impl Add for Mod {
    type Output = Self;
    fn add(self, rhs: Self) -> Self::Output {
        Mod((self.0 + rhs.0) % MOD)
    }
}

impl AddAssign for Mod {
    fn add_assign(&mut self, rhs: Self) {
        *self = *self + rhs;
    }
}

impl Sub for Mod {
    type Output = Self;
    fn sub(self, rhs: Self) -> Self::Output {
        Mod((self.0 + MOD - rhs.0 % MOD) % MOD)
    }
}

impl SubAssign for Mod {
    fn sub_assign(&mut self, rhs: Self) {
        *self = *self - rhs;
    }
}

impl Neg for Mod {
    type Output = Mod;
    fn neg(self) -> Mod {
        Mod(MOD - self.0)
    }
}

impl Mul for Mod {
    type Output = Self;
    fn mul(self, rhs: Self) -> Self::Output {
        Mod(self.0 % MOD * rhs.0 % MOD)
    }
}

impl MulAssign for Mod {
    fn mul_assign(&mut self, rhs: Self) {
        *self = *self * rhs;
    }
}

impl Div for Mod {
    type Output = Self;
    fn div(self, rhs: Self) -> Self::Output {
        if rhs.0 == 0 {
            loop {}
        }
        assert!(rhs.0 != 0);
        self * rhs.pow(MOD-2)
    }
}

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

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

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

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

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!();
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!();
}


use std::io::stdin;

fn main() {
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    let mut input = input.split_whitespace().map(|k| k.parse::<u32>().unwrap());
    let m = input.next().unwrap();
    let b = input.next().unwrap();

    let ans = (0..(m * b + 1)).map(|x| {
        let y = b - (x + m - 1) / m;
        let tmp = (x + 1) * (y + 1) * (x + y) / 2 ;
        tmp
    }).max().unwrap();

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


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

fn factorial(n: u32) -> u32 {
    (1..=n).fold(1, |acc, x| acc * x)
}

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let numbers: Vec<u32> = line
        .split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect();
    let a = numbers[0];
    let b = numbers[1];
    let ans = min(factorial(a), factorial(b));
    println!("{}", ans);
}


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

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

    println!("{}", (1..(input.i().min(input.i()) as i64))
             .product::<i64>());
}