use std::io;

fn main() {
    let mut w = String::new();
    io::stdin()
        .read_line(&mut w)
        .expect("Read error");

    let w: isize = w.trim().parse().expect("Parse error");

    let mut i = 1;
    while i < w && (i % 2 == 1 || (w - i) % 2 == 1) {
        i += 1;
    }

    if i < w {
        println!("YES");
    } else {
        println!("NO");
    }
}


fn main() {
    let mut v = String::new();
    std::io::stdin().read_line(&mut v);
    let v = v.trim();
    let result = v.parse::<u32>();
    let num:u32;
    match result {
        Ok(v)=> num = v,
        Err(e)=> panic!("failed to parse {}",e)
    }
    if num <= 3
    {
        println!("NO");
        return;
    }
    if num % 2 == 0
    {
        println!("YES")
    } else {
        println!("NO");
    }

}


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

    let line = buf.trim_end();

    if line.len() < 7 {
        println!("NO");
        return;
    }

    for index in 0..(line.len() - 7 + 1) {
        let substr: String = line.chars().skip(index).take(7).collect();

        if substr == "0000000" || substr == "1111111" {
            println!("YES");
            return;
        }
    }

    println!("NO");
}


use std::io::{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_p96a(input: &mut Read, out: &mut Write) {
    let mut scanner = Scanner::new(input);
    let s = scanner.next::<String>();
    if s.contains("0000000") || s.contains("1111111") {
        write!(out, "YES\n").ok();
    } else {
        write!(out, "NO\n").ok();
    }
}

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


#![allow(unused_imports)]
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::str::FromStr;

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

    let numbers = get_numbers(&input);
    let M = numbers[0];
    let N = numbers[1];
    println!("{}", cover(M, N));
}

fn cover(cols: u8, rows: u8) -> u8 {
    // start with laying them flat
    let flat = ((cols - (cols % 2)) / 2) * rows;

    let tall = if cols % 2 == 1 {
        // there is a leftover column, place dominos tall
        rows / 2
    } else {
        0
    };

    flat + tall
}

// get numbers from line seperated by spaces
fn get_numbers<T>(line: &str) -> Vec<T>
    where T: FromStr,
          <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    line.split_whitespace()
        .map(|chunk| chunk.parse::<T>().expect("failed to parse"))
        .collect()
}


macro_rules! input_list {
    ($var:ident, $type:ty, $ch:expr) => {
        let mut $var: Vec<$type> = Vec::new();
        let mut temp = String::new();
        std::io::stdin().read_line(&mut temp).unwrap();
        let temp_list: Vec<&str> = temp.split($ch).collect();
        for num in temp_list {
            $var.push(num.trim().parse::<$type>().unwrap());
        }
    }
}

fn main() {
    input_list!(size, i32, ' ');
    let dominoes_needed = (size[0] * size[1])/2;
    println!("{}", dominoes_needed);
}


use std::io;

/**fn main() {

    let mut input = String::new();
    println!("Say something: ");

    match io::stdin().read_line(&mut input){
        Ok(_) =>{
            println!("You typed {}",input);
        },
        Err(e) => println!("Error: {}",e)
    }
}*/
fn contar(line: &str) -> (isize, isize) {
    let mut x = 0;
    let mut y = 0;
    for i in line.chars(){
        match i {
                'Q' => x+=9,
                'R' => x+=5,
                'B' => x+=3,
                'N' => x+=3,
                'P' => x+=1,
                'q' => y+=9,
                'r' => y+=5,
                'b' => y+=3,
                'n' => y+=3,
                'p' => y+=1,
                _ => x = x,
        }
    }
    (x,y)
}

fn main(){
    let mut pw = 0;
    let mut pb = 0;
    for _ in 0..8 {
        let mut input = String::new();
        //println!("Say something: ");

        match io::stdin().read_line(&mut input){
            Ok(_) =>{
                let (xx,yy) = contar(&input);
                pw += xx;
                pb += yy;
                //println!("You typed {}",input);
            },
            Err(e) => println!("Error: {}",e)
        }
	}
    let res = pw-pb;
    /*match res {
        Ok(value) if value<0 => println!("Black"),
        Ok(value) if value>0 => println!("White"),
        Ok(value) if value==0 => println!("Draw"),
        Err(_) => println!("an error occurred"),

	}*/
    if res<0{
     println!("Black");
	} else if res>0{
        println!("White");
	}else{
        println!("Draw");
	}
    //println!("{} y {}",pw,pb);
}


use std::io;
use std::iter::Iterator;

fn conteo(input: String) -> i32 {
    let mut c :i32 = 0;

    for i in input.chars() {
        match i {
            'Q' => c += 9,
            'R' => c += 5,
            'B' | 'N' => c += 3,
            'P' => c += 1,
            'q' => c -= 9,
            'r' => c -= 5,
            'b' | 'n' => c -= 3,
            'p' => c -= 1,
            _ => (),
        }
    }

    return c;
}

fn main() {
    let mut comando = String::new();
    let mut res :i32 = 0;

    for _i in 0..8 {

        match io::stdin().read_line(&mut comando) {
            Ok(_n) => {
                let iter = comando.chars().filter(|&x| x != '.');
                res += conteo(iter.collect::<String>());
            }
            Err(error) => println!("error: {}", error),
        }

        comando = String::new();
    }

    if res > 0 {
        println!("White")
    }
    else if res < 0 {
        println!("Black")
    }
    else{
        println!("Draw")
    }
}


#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(dead_code)]

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

macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
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 ) * } } ; }
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

use std::f64;

fn min<T: PartialOrd>(a:T, b:T) -> T {
    if a < b { a }
    else { b }
}

fn max<T: PartialOrd>(a:T, b:T) -> T {
    if a < b { b }
    else { a }
}

use std::hash::Hash;
fn inc<T: Hash+Ord>(map:&mut BTreeMap<T,i64>, key:T) {
    let count = map.entry(key).or_insert(0);
    *count += 1;
}

fn int(ch: char) -> i64 {
    return (ch as u8 - b'0') as i64
}

const MAX:usize = 100006;
const INF:i64 = std::i64::MAX;
const MOD:i64 = 1e9 as i64 + 7;

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

    let mut dp = vec![-1;n+1];
    dp[0] = 0;

    for i in 0..n+1 {
        for j in 0..3 {
            if i < a[j] { continue; }
            if dp[i-a[j]] == -1 { continue; }
            dp[i] = max(dp[i], dp[i-a[j]]+1);
        }
    }
    //debug!(dp);

    println!("{}", dp[n]);
}

/*

長さ n のリボンを a,b,c のいずれかの長さにする。
このとき、最大のリボンの数を求める。

dp[i] := 長さ i のリボンを切れる最大の数
dp[i] = max(dp[i-a[j]]+1, j=0,1,2)

*/


use std::io::stdin;

fn read_line() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).expect("Failed to read a line");
    buf
}

fn read_params() -> (usize, Vec<usize>) {
    let line = read_line();
    let mut input = line.trim().split_whitespace().map(|x| x.parse::<usize>().unwrap());
    let n = input.next().unwrap();
    let mut sizes: Vec<usize> = input.collect();

    sizes.sort();
    if sizes.len() == 3 {
        if sizes[2] % sizes[0] == 0 || sizes[2] % sizes[1] == 0 {
            sizes.pop();
        }
    }
    if sizes.len() > 1 {
        if sizes[1] % sizes[0] == 0 {
            sizes.remove(1);
        }
    }

    (n, sizes)
}

fn calculate_max_cuts(n: usize, sizes: &[usize]) -> usize {
    if n % sizes.first().unwrap() == 0 {
        return n / sizes.first().unwrap();
    }

    let mut counts: Vec<usize> = vec![0; n + 1];
    for i in 1..counts.len() {
        for x in sizes.iter().cloned() {
            let value = if x > i {
                0
            } else if x == i {
                1
            } else if counts[i - x] == 0 {
                0
            } else {
                counts[i - x] + 1
            };
            counts[i] = std::cmp::max(value, counts[i]);
        }
    }

    *counts.last().unwrap()
}

fn main() {
    let (n, sizes) = read_params();
    println!("{}", calculate_max_cuts(n, &sizes));
}


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

const M: u64 = 998244353;

fn pow(n: u64, p: u64) -> u64 {
  let mut q = p;
  let mut r = n;
  let mut result = 1;
  while q > 0 {
    if q % 2 == 1 {
      result = result * r % M;
    }
    r = r * r % M;
    q >>= 1;
  }
  result
}

fn inv(n: u64) -> u64 {
  pow(n, M - 2)
}

fn main() {
  let stdin = io::stdin();
  let mut lines = stdin.lock().lines();
  let n: usize = lines.next().unwrap().unwrap().parse().unwrap();
  let mut cs: Vec<u64> = vec![0, 0];
  let mut x: u64 = 0;
  for i in 0..n {
    let p = i % 2;
    let q = (i + 1) % 2;
    x = (cs[q] + q as u64) % M;
    cs[p] = (cs[p] + x) % M;
  }
  let d = pow(2, n as u64);
  println!("{}", x * inv(d) % M);
}


#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

type Vec2<T> = Vec<Vec<T>>;
type Vec3<T> = Vec<Vec<Vec<T>>>;

#[allow(unused_macros)]
macro_rules! invec {
    ( $ t : ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}

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

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
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<_>>()
    };

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

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = i64::max_value() / 2;
#[allow(dead_code)]
static INF_I32: i32 = i32::max_value() / 2;
#[allow(dead_code)]
static INF_USIZE: usize = usize::max_value() / 2;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

#[derive(Debug, Copy, Clone)]
pub struct ModInt {
    x: i64,
    global_mod: i64,
}
impl ModInt {
    pub fn new(p: i64) -> Self {
        let gm = 998244353;
        let a = (p % gm + gm) % gm;
        return ModInt {
            x: a,
            global_mod: gm,
        };
    }
    pub fn inv(self) -> Self {
        return self.pow(self.global_mod - 2);
    }
    pub fn pow(self, t: i64) -> Self {
        if (t == 0) {
            return ModInt::new(1);
        };
        let mut a = self.pow(t >> 1);
        a = a * a;
        if (t & 1 != 0) {
            a = a * self
        };
        return a;
    }
}
impl Add for ModInt {
    type Output = ModInt;
    fn add(self, other: ModInt) -> ModInt {
        let ret = self.x + other.x;
        return ModInt::new(ret);
    }
}
impl Sub for ModInt {
    type Output = ModInt;
    fn sub(self, other: ModInt) -> ModInt {
        let ret = self.x - other.x;
        return ModInt::new(ret);
    }
}
impl Mul for ModInt {
    type Output = ModInt;
    fn mul(self, other: ModInt) -> ModInt {
        let ret = self.x * other.x;
        return ModInt::new(ret);
    }
}
impl Div for ModInt {
    type Output = ModInt;
    fn div(self, other: ModInt) -> ModInt {
        let ret = self.x * other.inv().x;
        return ModInt::new(ret);
    }
}
impl std::string::ToString for ModInt {
    fn to_string(&self) -> String {
        return self.x.to_string();
    }
}
pub struct Combination {
    fact: Vec<ModInt>,
    ifact: Vec<ModInt>,
}
impl Combination {
    pub fn new(n: i32) -> Self {
        if n > 3000000 {
            panic!("error");
        }
        let mut fact = vec![ModInt::new(0); (n + 1) as usize];
        let mut ifact = vec![ModInt::new(0); (n + 1) as usize];
        fact[0] = ModInt::new(1);
        for i in 1..n + 1 {
            fact[i as usize] = fact[(i - 1) as usize] * ModInt::new(i as i64)
        }
        ifact[n as usize] = fact[n as usize].inv();
        for i in (1..n + 1).rev() {
            ifact[(i - 1) as usize] = ifact[i as usize] * ModInt::new(i as i64)
        }
        let a = Combination {
            fact: fact,
            ifact: ifact,
        };
        return a;
    }
    #[macro_use]
    pub fn gen(&mut self, n: i32, k: i32) -> ModInt {
        if (k < 0 || k > n) {
            return ModInt::new(0 as i64);
        };
        return self.fact[n as usize] * self.ifact[k as usize] * self.ifact[(n - k) as usize];
    }
    pub fn P(&mut self, n: i32, k: i32) -> ModInt {
        self.fact[n as usize] * self.ifact[(n - k) as usize]
    }
}

fn main() {
    let N = get!(usize);

    let mut dp = vec![ModInt::new(0); N + 10];

    dp[0] = ModInt::new(1);

    let mut e = vec![ModInt::new(0); N + 2];
    let mut o = vec![ModInt::new(0); N + 2];

    for i in 0..N + 1 {
        if i % 2 == 0 {
            dp[i] = dp[i] + o[i];
            e[i + 1] = e[i] + dp[i];
            o[i + 1] = o[i];
        } else {
            dp[i] = dp[i] + e[i];
            o[i + 1] = o[i] + dp[i];
            e[i + 1] = e[i];
        }
    }

    mydbg!(dp[N]);
    let mut ans = ModInt::new(1) / ModInt::new(2).pow(N as i64);
    ans = ans * dp[N];
    echo!(ans.to_string());
}


#![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 (n, m) = scan!(s, i64, i64);
    let mut possible = false;

    let mut scale = m;
    while scale <= n {
        if 2*scale >= n {
            possible = true;
            break;
        }
        scale += m;
    }

    if possible {
        println!("{}", scale);
    } else {
        println!("-1");
    }
}


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

macro_rules! readln {
    () => {{
        use std::io;

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

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

fn main() {
    let (n,m) = readln!(i32,i32);
    let (mn,mx) = ((n+1)/2,n);
    let qmin = (mn+m-1)/m;
    let vmin = qmin*m;
    if vmin >= mn && vmin <= mx {
        println!("{}",vmin);
    } else {
        println!("-1");
    }
}


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

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

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

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

fn zeros_factorial(n: u64) -> u64 {
    let mut ans = 0;
    let mut n = n;
    while n > 0 {
        ans += n / 5;
        n /= 5;
    }
    ans
}

fn search(m: u64) -> u64 {
    let mut lo = 0;
    let mut hi = 500000; // zeros_factorial(n) >= n / 5
    while lo < hi {
        let mid = lo + (hi - lo) / 2;
        if zeros_factorial(mid) >= m {
            hi = mid;
        } else {
            lo = mid + 1;
        }
    }
    lo
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let m: u64 = scan.token();
    let n = search(m);
    if zeros_factorial(n) == m {
        writeln!(out, "5").ok();
        for i in 0..5 {
            write!(out, "{} ", n + i).ok();
        }
        writeln!(out).ok();
    } else {
        writeln!(out, "0").ok();
    }
}

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


use std::io;

fn main() {
//    let mut user_count = 0;
//    let mut size = 0;

    let mut input_text = String::new();
    io::stdin()
        .read_line(&mut input_text)
        .expect("failed to read from stdin");

    let mut id = 0;
    let mut array: [i32; 4] = [0; 4];

    for token in input_text.split_whitespace(){
        match token.parse::<i32>() {
            Ok(i) => {
                array[id] = i;
                id = id + 1;
            },
            Err(..) => {},
        };
    }

    array.sort();
    if (array[2] < (array[0] + array[1]) || array[3] < (array[1] + array[2])) {
        println!("TRIANGLE");
        return;
    };

    if (array[2] == (array[0] + array[1]) || array[3] == (array[1] + array[2])) {
        println!("SEGMENT");
        return;
    };

    println!("IMPOSSIBLE");

}


#[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 last_odd_number_less_than_number(n: i32) -> i32 {
    let mut i = n;
    while i > 0 {
        if i % 2 == 1 {
            return i;
        }
        i -= 1;
    }
    0
}

fn get_result(input: &u32) -> String {
    let base: i32 = 2;
    let num_of_players: i32 = base.pow(*input);
    last_odd_number_less_than_number(num_of_players)
        .to_string()
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());
    let n = scan.next::<u32>();
    let contents: Vec<u32> = (0..n).map(|_| scan.next()).collect();
    for content in contents {
        writeln!(out, "{}", get_result(&content)).ok();
    }
}


#![allow(warnings, unused)]
use std::cmp::Ordering;
use std::io::Write;

use std::cmp;
use std::cmp::min;
use std::collections::BTreeMap;
use std::process;
use std::cmp::Ord;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::collections::BTreeSet;
use std::mem;
use std::collections::BinaryHeap;
use std::hash::{Hash, Hasher};

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        std::str::from_utf8(&buf).unwrap()
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

pub trait BinarySearch<T> {
    fn lower_bound(&self, x:&T) -> usize;
    fn upper_bound(&self, x:&T) -> usize;
}

impl<T: Ord> BinarySearch<T> for VecDeque<T>{
    fn lower_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less => {
                    low = mid + 1;
                }
                Ordering::Equal | Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }

    fn upper_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less | Ordering::Equal => {
                    low = mid + 1;
                }
                Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }
}
impl<T: Ord> BinarySearch<T> for [T]{
    fn lower_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less => {
                    low = mid + 1;
                }
                Ordering::Equal | Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }

    fn upper_bound(&self, x: &T) -> usize {
        let mut low = 0;
        let mut high = self.len();

        while low != high {
            let mid = (low + high) / 2;
            match self[mid].cmp(x) {
                Ordering::Less | Ordering::Equal => {
                    low = mid + 1;
                }
                Ordering::Greater => {
                    high = mid;
                }
            }
        }
        low
    }
}

struct MultiSet<T> {
  set: BTreeSet<T>,
  map: HashMap<T, usize>
}

impl <T:Clone + Eq + Ord + Hash + Copy> MultiSet<T> {
  fn new() -> MultiSet<T> {
    MultiSet{
      set: BTreeSet::new(), map: HashMap::new()
    }
  }
  fn len(& self)->usize{
      return self.set.len();
  }
  fn contains(& self, i:&T)->bool{
      if self.set.contains(i){
          return true;
      }
      else{
          return false
      }
  }

  ///重複許可挿入
  fn insert(&mut self, i:T) -> Option<T>
  {
    if let Some(_i) = self.set.get(&i) {
      //setにある
      *self.map.entry(i).or_insert(0) += 1;
    }else{
      //setにない
      self.set.insert(i);
      *self.map.entry(i).or_insert(0) += 1;
    }
    return Some(i);
  }

  ///1つ削除
  fn remove(&mut self, e:&T) -> Option<T>
  {
    if let Some(_e) = self.set.get(e) {
      //setにある
      *self.map.entry(*e).or_insert(0) -= 1;
      if self.map[&e]==0 {
        //なくなった
        self.set.take(e);
      }
      return Some(*e);
    }else{
      //setにない
      return None;
    }
  }

  ///最小値の取得
  fn get_min(&self) -> Option<T>
  {
    if let Some(&m) = self.set.iter().nth(0) {
      return Some(m);
    }else{
      return None;
    }
  }

  ///最大値の取得
  fn get_max(&self) -> Option<T>
  {
    if let Some(&m) = self.set.iter().last() {
      return Some(m);
    }else{
      return None;
    }
  }
}
fn invs(max:usize)->(Vec<usize>, Vec<usize>){
    let mut fac = vec![0;max+1];
    let mut ifac = vec![0;max+1];
    fac[0] = 1;
    ifac[0] = 1;
    for i in 0..max{

        fac[i+1] = ((fac[i] as u64 * (i+1) as u64)%MODu as u64) as usize;
        ifac[i+1] = ((ifac[i] as u64 * modpow(i+1, MODu - 2) as u64)%MODu as u64) as usize;
    }
    (fac, ifac)
}
fn modpow(x:usize, n:usize) -> usize{
        let mut ans = 1;
        let mut n = n as usize;
        let mut x = x;
        while(n != 0){
            if (n&1 == 1){ans = (ans as u64*x as u64%MODu as u64) as usize;}
            x = (((x%MODu) as u64*(x%MODu) as u64)%MODu as u64) as usize;
            n = n>>1;
        }
        ans
}
fn comb(a:usize, b:usize,  fac:&Vec<usize>, ifac:&Vec<usize>)->usize{
        let mut a = a;
        let mut b = b;
        if a == 0 && b == 0{return 1;}
        if a<b || a<0{return 0;}
        let mut tmp = (ifac[a-b] as u64*ifac[b] as u64%MODu as u64) as usize;
        return (tmp as u64 * fac[a] as u64%MODu as u64) as usize;
}
struct union_find{
    par:Vec<usize>,
    rank:Vec<usize>,
    size:Vec<usize>,
    size_edge:Vec<usize>,
}
impl union_find{
    fn new(n:usize) -> union_find{
        let mut par = vec![0;n];
        for i in 0..n{
            par[i] = i;
        }
        union_find{
            par:par,
            rank:vec![0;n],
            size:vec![1;n],
            size_edge:vec![0;n],
        }
    }
    fn find(&mut self, x:usize) ->usize{
        if(self.par[x] == x){
            x
        }
        else{
            let p = self.par[x];
            let res = self.find(p);
            self.par[x] = res;
            res
        }
    }
    fn same(&mut self, a:usize, b:usize)->bool{
        self.find(a) == self.find(b)
    }
    fn unite(&mut self, a:usize, b:usize){
        let x = self.find(a);
        let y = self.find(b);
        if x != y{
            if (self.rank[x] < self.rank[y]){
                self.par[x] = y;
                self.size[y] += self.size[x];
                self.size_edge[y] += self.size_edge[x];
                self.size_edge[y] += 1;
            }
            else{
                self.par[y] = x;
                self.size[x] += self.size[y];
                self.size_edge[x] += self.size_edge[y];
                self.size_edge[x] += 1;
                if(self.rank[x] == self.rank[y]){ self.rank[x]+=1;}
            }

        }
        else{
            self.size_edge[x] += 1;
        }
    }
    fn check_size(&mut self, a:usize) -> usize{
        let x = self.find(a);
        let s = self.size[x];
        s
    }
}

struct segment_tree<I, Op>{
    n: usize,
    dat: Vec<I>,
    op:Op,
    e:I,
}
impl<I, Op> segment_tree<I, Op>

    where Op: Fn(I, I) -> I, I:Copy{

        pub fn new(n_:usize, op: Op, e:I)->Self{
            let mut n = 1;
            while(n<n_){n*=2;}
            segment_tree{n: n, dat:vec![e; 2*n-1], op:op, e:e}
        }
        pub fn update(&mut self, k:usize, a:I){
            let mut k = k;
            k += self.n-1;
            self.dat[k] = a;
            while(k>0){
                k = (k-1)/2;
                self.dat[k] = (self.op)(self.dat[k*2 + 1], self.dat[k*2+2]);
            }
        }

        pub fn query_sub(&self, a:usize, b:usize, k:usize, l:usize, r:usize) -> I{
            if r<=a || b<=l{return self.e;}
            if a<=l && r<=b{return self.dat[k];}
            else{
                let mut vl = self.query_sub(a, b, k*2+1, l, (l+r)/2);
                let mut vr = self.query_sub(a, b, k*2+2, (l+r)/2, r);
                return (self.op)(vl, vr);
            }
        }
        pub fn query(&self, a:usize, b:usize)->I{
            return self.query_sub(a, b, 0, 0, self.n);
        }
    }

struct rolling_hash{
    base1:u64,
    base2:u64,
    mod1:u64,
    mod2:u64,
    hash1:Vec<u64>,
    hash2:Vec<u64>,
    power1:Vec<u64>,
    power2:Vec<u64>
}

impl rolling_hash{
    fn new(S:&Vec<u64>)->rolling_hash{
        let mut n = S.len();
        let mut base1 = 1007;
        let mut base2 = 2009;
        let mut mod1 = 1000000007;
        let mut mod2 = 1000000009;
        let mut hash1 = vec![0;n+1];
        let mut hash2 = vec![0;n+1];
        let mut power1 = vec![1;n+1];
        let mut power2 = vec![1;n+1];

        for i in 0..n{
            hash1[i+1] = (hash1[i] * base1 + S[i])%mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i])%mod2;
            power1[i+1] = (power1[i] * base1)%mod1;
            power2[i+1] = (power2[i] * base2)%mod2;
        }

        return rolling_hash{
            hash1:hash1,
            hash2:hash2,
            power1:power1,
            power2:power2,
            base1:base1,
            base2:base2,
            mod1:mod1,
            mod2:mod2
        }
    }
    // [l, r)
    fn get(&self, l:usize, r:usize)->(u64, u64){
        let mut res1 = self.hash1[r] as i64 - self.hash1[l] as i64 * self.power1[r-l] as i64%self.mod1 as i64;
        if (res1<0) {res1+= self.mod1 as i64;}
        let mut res2 = self.hash2[r] as i64 - self.hash2[l] as i64 * self.power2[r-l] as i64%self.mod2 as i64;
        if (res2<0) {res2+= self.mod2 as i64;}
        return (res1 as u64, res2 as u64);
    }
}
fn base_number(x:u64, n:u64)->Vec<u64>{
    let mut x = x;
    let mut n = n;
    let mut r = 1;
    let mut q = x;
    let mut res = vec![];
    while(q>=n){
        r = q%n;
        res.push(r);
        q = q/n;
    }
    r = q%n;
    res.push(r);
    res.reverse();
    return res
}
pub struct point_set_range_max {
            xss: Vec<Vec<i64>>,
            h: usize,
            w: usize,
            initial: i64,
        }

        impl point_set_range_max {
            pub fn new(h: usize, w: usize, initial: i64) -> Self {
                let H = w.next_power_of_two();
                let W = h.next_power_of_two();
                Self {
                    xss: vec![vec![initial; 2 * W]; 2 * H],
                    h:H,
                    w:W,
                    initial,
                }
            }
            fn update(&mut self, x: usize, y: usize) {
                if x >= self.w && y >= self.h {
                    return;
                }
                let s = if x < self.w {
                    std::cmp::max(self.xss[y][2 * x + 0], self.xss[y][2 * x + 1])
                } else {
                    self.initial
                };
                let t = if y < self.h {
                    std::cmp::max(self.xss[2 * y + 0][x], self.xss[2 * y + 1][x])
                } else {
                    self.initial
                };
                let r = std::cmp::max(s, t);
                self.xss[y][x] = r;
            }
            pub fn set(&mut self, x: usize, y: usize, v: i64) {
                self.xss[y + self.h][x + self.w] = v;
                let mut x = x + self.w;
                while x > 0 {
                    let mut y = y + self.h;
                    while y > 0 {
                        self.update(x, y);
                        y >>= 1;
                    }
                    x >>= 1;
                }
            }
            pub fn query(&mut self, l: usize, r: usize, u: usize, d: usize) -> i64 {
                let mut l = l + self.w;
                let mut r = r + self.w;
                let mut res = self.initial;
                while l < r {
                    if l & 1 != 0 {
                        let mut u = u + self.h;
                        let mut d = d + self.h;
                        while u < d {
                            if u & 1 != 0 {
                                res = std::cmp::max(res, self.xss[u][l]);
                                u += 1;
                            }
                            if d & 1 != 0 {
                                d -= 1;
                                res = std::cmp::max(res, self.xss[d][l]);
                            }
                            u >>= 1;
                            d >>= 1;
                        }
                        l += 1;
                    }
                    if r & 1 != 0 {
                        r -= 1;
                        let mut u = u + self.h;
                        let mut d = d + self.h;
                        while u < d {
                            if u & 1 != 0 {
                                res = std::cmp::max(res, self.xss[u][r]);
                                u += 1;
                            }
                            if d & 1 != 0 {
                                d -= 1;
                                res = std::cmp::max(res, self.xss[d][r]);
                            }
                            u >>= 1;
                            d >>= 1;
                        }
                    }
                    l >>= 1;
                    r >>= 1;
                }
                res
            }
        }

pub struct point_set_range_sum_bool {
            xss: Vec<Vec<bool>>,
            h: usize,
            w: usize,
            initial: bool,
        }

        impl point_set_range_sum_bool {
            pub fn new(h: usize, w: usize, initial: bool) -> Self {
                let H = w.next_power_of_two();
                let W = h.next_power_of_two();
                Self {
                    xss: vec![vec![initial; 2 * W]; 2 * H],
                    h:H,
                    w:W,
                    initial,
                }
            }
            fn update(&mut self, x: usize, y: usize) {
                if x >= self.w && y >= self.h {
                    return;
                }
                let s = if x < self.w {
                    self.xss[y][2 * x + 0] | self.xss[y][2 * x + 1]
                } else {
                    self.initial
                };
                let t = if y < self.h {
                   self.xss[2 * y + 0][x] | self.xss[2 * y + 1][x]
                } else {
                    self.initial
                };
                let r = s | t;
                self.xss[y][x] = r;
            }
            pub fn set(&mut self, x: usize, y: usize, v: bool) {
                self.xss[y + self.h][x + self.w] = v;
                let mut x = x + self.w;
                while x > 0 {
                    let mut y = y + self.h;
                    while y > 0 {
                        self.update(x, y);
                        y >>= 1;
                    }
                    x >>= 1;
                }
            }
            pub fn query(&mut self, l: usize, r: usize, u: usize, d: usize) -> bool {
                let mut l = l + self.w;
                let mut r = r + self.w;
                let mut res = self.initial;
                while l < r {
                    if l & 1 != 0 {
                        let mut u = u + self.h;
                        let mut d = d + self.h;
                        while u < d {
                            if u & 1 != 0 {
                                res = res | self.xss[u][l];
                                u += 1;
                            }
                            if d & 1 != 0 {
                                d -= 1;
                                res = res | self.xss[d][l];
                            }
                            u >>= 1;
                            d >>= 1;
                        }
                        l += 1;
                    }
                    if r & 1 != 0 {
                        r -= 1;
                        let mut u = u + self.h;
                        let mut d = d + self.h;
                        while u < d {
                            if u & 1 != 0 {
                                res = res | self.xss[u][r];
                                u += 1;
                            }
                            if d & 1 != 0 {
                                d -= 1;
                                res = res | self.xss[d][r];
                            }
                            u >>= 1;
                            d >>= 1;
                        }
                    }
                    l >>= 1;
                    r >>= 1;
                }
                res
            }
        }

//最大公約数
fn gcd(a:usize, b:usize)->usize{
    if b==0{return a;}
    return gcd(b, a%b);
}
enum Node {
    Operator {
        nxt0: Box<Node>,
        nxt1: Box<Node>,
    },
    Number {
        lazy:i64,
        cnt:i64
    },
}
fn dijkstra(s:usize, g:&Vec<Vec<(usize, i64)>>)->Vec<i64>{
    let mut dist = vec![INF;g.len()];
    dist[s] = 0;
    let mut h = BinaryHeap::new();
    h.push((0, s));
    while(h.len() != 0){
        let mut t = h.pop().unwrap();
        let mut d = t.0 * -1;
        let mut v = t.1;
        if dist[v]<d{
            continue;
        }
        for i in 0..g[v].len(){
            let n = g[v][i].0;
            let dd = g[v][i].1;
            if dist[n]>d+dd{
                dist[n] = d+dd;
                h.push((dist[n]*-1, n));
            }
        }
    }
    return dist;
}
fn safe_mod(x:i64, m:i64)->i64{
    let mut x = x;
    let mut m = m;
    x%=m;
    if x<0{
        x+=m;
    }
    return x;
}
fn pow_mod(x: i64, mut n: i64, m: i64) -> i64 {
    if m == 1 {
        return 0;
    }
    let _m = m as u32;
    let mut r: u64 = 1;
    let mut y: u64 = safe_mod(x, m as i64) as u64;
    while n != 0 {
        if (n & 1) > 0 {
            r = (r * y) % (_m as u64);
        }
        y = (y * y) % (_m as u64);
        n >>= 1;
    }
    r as i64
}
fn is_prime(n: i64) -> bool {
    let n = n as i64;
    match n {
        _ if n <= 1 => return false,
        2 | 7 | 61 => return true,
        _ if n % 2 == 0 => return false,
        _ => {}
    }
    let mut d = n - 1;
    while d % 2 == 0 {
        d /= 2;
    }
    for &a in &[2, 7, 61] {
        let mut t = d;
        let mut y = pow_mod(a, t, n as i64);
        while t != n - 1 && y != 1 && y != n - 1 {
            y = y * y % n;
            t <<= 1;
        }
        if y != n - 1 && t % 2 == 0 {
            return false;
        }
    }
    true
}
fn prime_factor(n:i64)->HashMap<i64, i64>{
    let mut res = HashMap::new();
    let mut n = n;
    for i in 2..n{
        if i*i>n{break;}
        while(n%i==0){
            *res.entry(i).or_insert(0)+=1;
            n/=i;
        }
    }
    if n != 1{
        res.insert(n, 1);
    }
    res
}
fn solve(){
    let sssss = std::io::stdin();
    let mut sc = Scanner { stdin: sssss.lock() };
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    let mut test:usize = sc.read();
    for _ in 0..test{
        let mut i:i64 = sc.read();

        writeln!(out, "{}", (1<<i)-1);

    }

}

fn main(){
    solve();
}

const PI:f64 = std::f64::consts::PI;
pub static MOD:i64    = 998244353;
pub static MODu:usize = 998244353;
pub static MODi32:i32 = 998244353;
pub static eps:f64 = 1e-6;
const INF: i64 = 1 << 60;
const INFu:usize = 1<<30;


//spnauti-rusT {{{
#[allow(unused_imports)]use std::{io::*,collections::*,fmt::Debug,str::{self,*},cmp::*,ops::{self,*},iter::{self,*}};
macro_rules!rp{{[$c:expr]$($s:tt)+}=>(for _ in 0..$c{$($s)+})}
macro_rules!l{
	($($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;)+};($($v:ident),+ =$e:expr)=>{$(let$v=$e;)+};}
macro_rules!v{
	($(:$t:ty)?=$e:expr)=>{$e$(as$t)?};([$d:expr]$(:$t:ty)?)=>{Vec::$(<$t>::)?with_capacity($d)};
	([]$(:$t:ty)?)=>{Vec::$(<$t>::)?new()};([$d:expr]$($s:tt)+)=>{vec![v!($($s)+);$d]};}
fn rio()->(Reader,BufWriter<Stdout>){(Reader::new(),BufWriter::new(stdout()))}
struct Reader{buf:Vec<u8>,pos:usize,x:*mut Stdin,q:StdinLock<'static>}//'
#[allow(dead_code)]impl Reader{
	fn new()->Self{let x=Box::into_raw(Box::new(stdin()));let q=unsafe{&*x}.lock();Self{x,q,buf:v!([]),pos:0}}
	fn next_line(&mut self)->bool{self.buf.clear();self.pos=0;self.q.read_until(b'\n',&mut self.buf).unwrap_or(0)>0}
	fn byte(&mut self)->Option<u8>{
		if self.pos==self.buf.len(){if!self.next_line(){return None;}}self.pos+=1;Some(self.buf[self.pos-1])}
	fn vb(&mut self)->Vec<u8>{let mut s=v!([10]);let mut f=false;while let Some(c)=self.byte(){
		if!c.is_ascii_whitespace(){s.push(c);f=true;}else if f{break;}}s}
	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 u(&mut self) ->  usize { self.p() }
}impl Drop for Reader{fn drop(&mut self){unsafe{Box::from_raw(self.x)};}}
//----------}}}

// Field (mod prime) {{{
mod field {
	use std::ops::*;
	#[allow(dead_code)] pub const Z0: Field = Field(0);
	#[allow(dead_code)] pub const Z1: Field = Field(1);
	const P5: i32 = 998_244_353;
	const P6: i64 = P5 as i64;
	#[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Default)] pub struct Field(pub i32);
	#[allow(dead_code)] impl Field {
		pub fn new<T: Into<i64>>(a: T) -> Self { Self(Self::cv(a)) }
		pub unsafe fn new_unchecked(a: i32) -> Self { Self(a) }
		fn hi(mut a: i32) -> i32 { if a >= P5 { a -= P5; } a }
		fn lo(mut a: i32) -> i32 { if a < 0 { a += P5; } a }
		fn cv<T: Into<i64>>(a: T) -> i32 { Self::lo((a.into() % P6) as i32) }
		pub fn inv(self) -> Self { self.pow(P5-2) }
		pub fn pow<T: Into<i64>>(self, b: T) -> Self {
			let b = b.into(); if b == 0 { Self(1) } else {
				let mut res = self.pow(b/2); res *= res; if b % 2 == 1 {res *= self;} res
			}
		}
	}
	impl Add for Field { type Output = Self; fn add(self, a: Self) -> Self::Output { Self(Self::hi(self.0 + a.0)) }}
	impl Sub for Field { type Output = Self; fn sub(self, a: Self) -> Self::Output { Self(Self::lo(self.0 - a.0)) }}
	impl Mul for Field { type Output = Self; fn mul(self, a: Self) -> Self::Output { Self(Self::cv(self.0 as i64 * a.0 as i64)) }}
	impl Div for Field { type Output = Self; fn div(self, a: Self) -> Self::Output { self * a.inv() }}
	impl Neg for Field { type Output = Self; fn neg(self) -> Self::Output { Self(Self::lo(-self.0)) }}
	impl AddAssign for Field { fn add_assign(&mut self, a: Self) { *self = *self + a; } }
	impl SubAssign for Field { fn sub_assign(&mut self, a: Self) { *self = *self - a; } }
	impl MulAssign for Field { fn mul_assign(&mut self, a: Self) { *self = *self * a; } }
	impl DivAssign for Field { fn div_assign(&mut self, a: Self) { *self = *self / a; } }
	use std::fmt::{Display, Formatter, Result};
	impl Display for Field { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, "{}", self.0) } }
}
#[allow(unused_imports)] use field::{Field, Field as Z, Z0, Z1};
//}}}

fn main() {
	let (mut rin,mut rout) = rio();
	const N: usize = 500;

	l!(mut f,fi = v!([N+1] = Z1));
	for i in 2..N {
		f[i] = f[i-1] * Z::new(i as i32);
		fi[i] = f[i].inv();
	}
	let cnr = |n,r| -> Z {
		if r > n {
			Z0
		} else {
			f[n] * fi[n-r] * fi[r]
		}
	};
	let mut p = v!([N+1][N+1]);
	for i in 0..=N {
		let x = Z::new(i as i32);
		let mut y = Z1;
		let p = &mut p[i];
		rp!{[N+1]
			p.push(y);
			y *= x;
		}
	}

	l!(n,x = rin.u());
	let mut dp = v!([x+1][n+1] = Z0);
	let mut s = Z0;
	for i in 1..=x {
		dp[i][1] = Z1;
		for j in 2..=n.min(i) {
			let mut res = Z0;
			for k in 1..=j {
				res += dp[i-j+1][k] * p[j-1][j-k] * cnr(j-1,k-1);
			}
			dp[i][j] = res;
		}
		s += dp[i][n];
	}
	s *= Z::new(n as i32);
	let ans = p[x][n] - s;
	writeln!(rout, "{}", ans).unwrap();
}


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

macro_rules! impl_common_num_ext {
    ($($ix:tt = $ux:tt),*) => {
        $(
            impl CommonNumExt for $ux {
                fn div_ceil(self, b: Self) -> Self {
                    let q = self / b; let r = self % b;
                    if r != 0 { q + 1 } else { q }
                }
                fn div_floor(self, b: Self) -> Self { self / b }
                fn gcd(self, mut b: Self) -> Self {
                    let mut a = self; while a != 0 { swap(&mut a, &mut b); a %= b; }
                    b
                }
                #[inline] fn highest_one(self) -> Self {
                    if self == 0 { 0 } else { const ONE: $ux = 1; ONE.rotate_right(1) >> self.leading_zeros() }
                }
                #[inline] fn lowest_one(self) -> Self { self & self.wrapping_neg() }
            }

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

trait ChMaxMin<T> {
    fn set_max(&mut self, v: T) -> bool;
    fn set_min(&mut self, v: T) -> bool;
}
impl<T: PartialOrd> ChMaxMin<T> for T {
    fn set_max(&mut self, v: T) -> bool { if v > *self { *self = v; true } else { false } }
    fn set_min(&mut self, v: T) -> bool { if v < *self { *self = v; true } else { false } }
}

// * end commons * //

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    macro_rules! dynamic_modulus {
        ($mint: ident, $name: ident, $modulus: ident) => {
            static $modulus: crate::Unsync<Cell<u32>> = crate::Unsync(Cell::new(0));
            #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
            pub enum $name {}
            impl Modulus for $name {
                fn get_modulus() -> u32 { $modulus.0.get() }
            }
            impl $name {
                pub fn set_modulus(val: u32) { $modulus.0.set(val) }
            }
            pub type $mint = ModIntBase<$name>;
        }
    }

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

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

fn mod_factorials(maxn: usize) -> Vec<ModInt> {
    let mut res = vec![ModInt::default(); maxn+1];
    res[0] = 1.into();
    for i in 1..=maxn {
        res[i] = res[i-1] * i
    }
    return res;
}

struct ModCombinatorics {
    factorials: Vec<ModInt>,
    inv_factorials: Vec<ModInt>
}
impl ModCombinatorics {
    fn new(maxn: usize) -> Self {
        let factorials = mod_factorials(maxn);
        let mut inv = vec![ModInt::default(); maxn+1];
        inv[maxn] = factorials[maxn].inv();
        for i in (1..=maxn).rev() {
            inv[i-1] = inv[i] * i;
        }
        Self { factorials, inv_factorials: inv }
    }
    #[inline]
    fn factorial(&self, n: usize) -> ModInt { self.factorials[n] }
    #[inline]
    fn inv_factorial(&self, n: usize) -> ModInt { self.inv_factorials[n] }
    fn P(&self, n: usize, k: usize) -> ModInt {
        if k > n { ModInt::raw(0) } else { self.factorial(n) * self.inv_factorial(n-k) }
    }
    fn C(&self, n: usize, k: usize) -> ModInt {
        if k > n { ModInt::raw(0) } else { self.factorial(n) * self.inv_factorial(k) * self.inv_factorial(n-k) }
    }

    // multi-choose, be sure to adjust maxn accordingly
    fn M(&self, n: usize, k: usize) -> ModInt {
        if k == 0 { 1.into() } else { self.C(n + k - 1, k) }
    }
}

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

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

        let mc = ModCombinatorics::new(n);

        let P = veci!(x+1, i: ModInt::pow_vec(mi(i), n));

        struct Dp<'a> {
            D: Vec<Vec<Cell<Option<ModInt>>>>,
            f: &'a dyn Fn(&Dp, usize, usize) -> ModInt
        }

        let dp = Dp {
            D: vec![vec![Cell::new(None); x+1]; n+1],
            f: &mut|dp, i, j| {
                match dp.D[i][j].get() {
                    Some(x) => x,
                    None => {
                        let res = if j < i { P[j][i] - P[j-1][i] } else {
                            (2..=i).map(|k| (dp.f)(dp, k, j-(i-1)) * mc.C(i, k) * P[i-1][i-k]).sum()
                        };

                        dp.D[i][j].set(Some(res));
                        res
                    }
                }
            }
        };

        let mut ans = mi(0);
        for i in 1..=x { ans += (dp.f)(&dp, n, i); }
        println!(ans);
    }

    out_flush();
}


//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 n = input.i() as usize;
    let t = input.i();
    let mut a = input.ab();

    for _ in 0..t {
        let mut b = a.clone();
        for i in (0..n-1).rev() {
            if a[i] == b'B' && a[i + 1] == b'G' {
                b[i] = b'G';
                b[i + 1] = b'B';
            }
        }
        a = b;
    }
    println!("{}", String::from_utf8(a).unwrap());
}


use std::io;

fn main() {
    let (num,turns,mut list)=input();
    for _ in 0..turns{
        let mut ii=1;
        while ii<num{
            if &list[ii as usize].to_string()=="G" && &list[(ii-1) as usize].to_string()=="B"{
                let boy=list[(ii-1) as usize];
                list[(ii-1) as usize]=list[ii as usize];
                list[ii as usize]=boy;
                ii+=1;
            }ii+=1;
        }
    }let mut sum=String::from("");
    for i in list{
        sum=sum+&i.to_string();
    }println!("{}",sum);
}

fn read() -> String{
    let mut input=String::new();
    io::stdin().read_line(&mut input).expect("unable to read");
    input.trim().to_string()
}

fn input() -> (i32,i32,Vec<char>){
    let inp=read();
    let list: Vec<_>=inp.split_whitespace().collect();
    let qu: Vec<_>=read().chars().collect();
    (list[0].parse::<i32>().expect("Failed to parse"),
    list[1].parse::<i32>().expect("Failed to parse"),qu)
}


// ---------- begin ModInt ----------
// モンゴメリ乗算を用いる
// ほぼCodeforces用
// 注意
// new_unchecked は値xが 0 <= x < modulo であることを仮定
// ModInt の中身は正規化された値で持ってるので直接読んだり書いたりするとぶっ壊れる
// 奇素数のみ
mod modint {

    use std::marker::*;
    use std::ops::*;

    pub trait Modulo {
        fn modulo() -> u32;
        fn rem() -> u32;
        fn ini() -> u64;
        fn reduce(x: u64) -> u32 {
            assert!(x < (Self::modulo() as u64) << 32);
            let b = (x as u32 * Self::rem()) as u64;
            let t = x + b * Self::modulo() as u64;
            let mut c = (t >> 32) as u32;
            if c >= Self::modulo() {
                c -= Self::modulo();
            }
            c as u32
        }
    }

    #[allow(dead_code)]
    pub enum Mod1_000_000_007 {}

    impl Modulo for Mod1_000_000_007 {
        fn modulo() -> u32 {
            1_000_000_007
        }
        fn rem() -> u32 {
            2226617417
        }
        fn ini() -> u64 {
            582344008
        }
    }

    #[allow(dead_code)]
    pub enum Mod998_244_353 {}

    impl Modulo for Mod998_244_353 {
        fn modulo() -> u32 {
            998_244_353
        }
        fn rem() -> u32 {
            998244351
        }
        fn ini() -> u64 {
            932051910
        }
    }

    #[allow(dead_code)]
    pub fn generate_umekomi_modulo(p: u32) {
        assert!(
            p < (1 << 31)
                && p > 2
                && p & 1 == 1
                && (2u32..).take_while(|v| v * v <= p).all(|k| p % k != 0)
        );
        let mut t = 1u32;
        let mut s = !p + 1;
        let mut n = !0u32 >> 2;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        let mut ini = (1u64 << 32) % p as u64;
        ini = (ini << 32) % p as u64;
        assert!(t * p == !0);
        println!("pub enum Mod{} {{}}", p);
        println!("impl Modulo for Mod{} {{", p);
        println!("    fn modulo() -> u32 {{");
        println!("        {}", p);
        println!("    }}");
        println!("    fn rem() -> u32 {{");
        println!("        {}", t);
        println!("    }}");
        println!("    fn ini() -> u32 {{");
        println!("        {}", ini);
        println!("    }}");
        println!("}}");
        let mut f = vec![];
        let mut n = p - 1;
        for i in 2.. {
            if i * i > n {
                break;
            }
            if n % i == 0 {
                f.push(i);
                while n % i == 0 {
                    n /= i;
                }
            }
        }
        if n > 1 {
            f.push(n);
        }
        let mut order = 1;
        let mut n = p - 1;
        while n % 2 == 0 {
            n /= 2;
            order <<= 1;
        }
        let z = (2u64..)
            .find(|z| {
                f.iter()
                    .all(|f| mod_pow(*z, ((p - 1) / *f) as u64, p as u64) != 1)
            })
            .unwrap();
        let zeta = mod_pow(z, ((p - 1) / order) as u64, p as u64);
        println!("impl transform::NTTFriendly for Mod{} {{", p);
        println!("    fn order() -> usize {{");
        println!("        {}", order);
        println!("    }}");
        println!("    fn zeta() -> u32 {{");
        println!("        {}", zeta);
        println!("    }}");
        println!("}}");
    }

    pub struct ModInt<T>(u32, PhantomData<T>);

    impl<T> Clone for ModInt<T> {
        fn clone(&self) -> Self {
            ModInt::build(self.0)
        }
    }

    impl<T> Copy for ModInt<T> {}

    impl<T: Modulo> Add for ModInt<T> {
        type Output = ModInt<T>;
        fn add(self, rhs: Self) -> Self::Output {
            let mut d = self.0 + rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            Self::build(d)
        }
    }

    impl<T: Modulo> AddAssign for ModInt<T> {
        fn add_assign(&mut self, rhs: Self) {
            *self = *self + rhs;
        }
    }

    impl<T: Modulo> Sub for ModInt<T> {
        type Output = ModInt<T>;
        fn sub(self, rhs: Self) -> Self::Output {
            let mut d = self.0 - rhs.0;
            if d >= T::modulo() {
                d += T::modulo();
            }
            Self::build(d)
        }
    }

    impl<T: Modulo> SubAssign for ModInt<T> {
        fn sub_assign(&mut self, rhs: Self) {
            *self = *self - rhs;
        }
    }

    impl<T: Modulo> Mul for ModInt<T> {
        type Output = ModInt<T>;
        fn mul(self, rhs: Self) -> Self::Output {
            Self::build(T::reduce(self.0 as u64 * rhs.0 as u64))
        }
    }

    impl<T: Modulo> MulAssign for ModInt<T> {
        fn mul_assign(&mut self, rhs: Self) {
            *self = *self * rhs;
        }
    }

    impl<T: Modulo> Neg for ModInt<T> {
        type Output = ModInt<T>;
        fn neg(self) -> Self::Output {
            if self.0 == 0 {
                Self::zero()
            } else {
                Self::build(T::modulo() - self.0)
            }
        }
    }

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

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

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

    impl<T: Modulo> From<usize> for ModInt<T> {
        fn from(val: usize) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as usize) as u32)
        }
    }

    impl<T: Modulo> From<u64> for ModInt<T> {
        fn from(val: u64) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as u64) as u32)
        }
    }

    impl<T: Modulo> From<i64> for ModInt<T> {
        fn from(val: i64) -> ModInt<T> {
            let m = T::modulo() as i64;
            ModInt::new((val % m + m) as u32)
        }
    }

    #[allow(dead_code)]
    impl<T> ModInt<T> {
        fn build(d: u32) -> Self {
            ModInt(d, PhantomData)
        }
        pub fn zero() -> Self {
            Self::build(0)
        }
        pub fn is_zero(&self) -> bool {
            self.0 == 0
        }
    }

    #[allow(dead_code)]
    impl<T: Modulo> ModInt<T> {
        pub fn new_unchecked(d: u32) -> Self {
            Self::build(T::reduce(d as u64 * T::ini()))
        }
        pub fn new(d: u32) -> Self {
            Self::new_unchecked(d % T::modulo())
        }
        pub fn one() -> Self {
            Self::new_unchecked(1)
        }
        pub fn get(&self) -> u32 {
            T::reduce(self.0 as u64)
        }
        pub fn pow(&self, mut n: u64) -> Self {
            let mut t = Self::one();
            let mut s = *self;
            while n > 0 {
                if n & 1 == 1 {
                    t *= s;
                }
                s *= s;
                n >>= 1;
            }
            t
        }
        pub fn inv(&self) -> Self {
            assert!(!self.is_zero());
            self.pow((T::modulo() - 2) as u64)
        }
    }

    pub fn mod_pow(mut r: u64, mut n: u64, m: u64) -> u64 {
        let mut t = 1 % m;
        while n > 0 {
            if n & 1 == 1 {
                t = t * r % m;
            }
            r = r * r % m;
            n >>= 1;
        }
        t
    }
}
// ---------- end ModInt ----------
// ---------- begin Precalc ----------
mod precalc {
    use super::modint::*;
    #[allow(dead_code)]
    pub struct Precalc<T> {
        inv: Vec<ModInt<T>>,
        fact: Vec<ModInt<T>>,
        ifact: Vec<ModInt<T>>,
    }
    #[allow(dead_code)]
    impl<T: Modulo> Precalc<T> {
        pub fn new(n: usize) -> Precalc<T> {
            let mut inv = vec![ModInt::one(); n + 1];
            let mut fact = vec![ModInt::one(); n + 1];
            let mut ifact = vec![ModInt::one(); n + 1];
            for i in 2..(n + 1) {
                fact[i] = fact[i - 1] * ModInt::new_unchecked(i as u32);
            }
            ifact[n] = fact[n].inv();
            if n > 0 {
                inv[n] = ifact[n] * fact[n - 1];
            }
            for i in (1..n).rev() {
                ifact[i] = ifact[i + 1] * ModInt::new_unchecked((i + 1) as u32);
                inv[i] = ifact[i] * fact[i - 1];
            }
            Precalc {
                inv: inv,
                fact: fact,
                ifact: ifact,
            }
        }
        pub fn inv(&self, n: usize) -> ModInt<T> {
            assert!(n > 0);
            self.inv[n]
        }
        pub fn fact(&self, n: usize) -> ModInt<T> {
            self.fact[n]
        }
        pub fn ifact(&self, n: usize) -> ModInt<T> {
            self.ifact[n]
        }
        pub fn perm(&self, n: usize, k: usize) -> ModInt<T> {
            if k > n {
                return ModInt::zero();
            }
            self.fact[n] * self.ifact[n - k]
        }
        pub fn comb(&self, n: usize, k: usize) -> ModInt<T> {
            if k > n {
                return ModInt::zero();
            }
            self.fact[n] * self.ifact[k] * self.ifact[n - k]
        }
    }
}
// ---------- end Precalc ----------

use modint::*;

type M = ModInt<Mod1_000_000_007>;

// ---------- begin input macro ----------
// reference: https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, bytes) => {
        read_value!($iter, String).bytes().collect::<Vec<u8>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
// ---------- end input macro ----------

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

type Map<K, V> = BTreeMap<K, V>;
type Set<T> = BTreeSet<T>;
type Deque<T> = VecDeque<T>;

fn run() {
    input! {
        h: u64,
        w: u64,
        k: u64,
        r: u64,
        c: u64,
        a: (u64, u64),
        b: (u64, u64),
    }
    let mut a = a;
    let mut b = b;
    if a.1 > b.1 {
        std::mem::swap(&mut a, &mut b);
    }
    if a.0 > b.0 {
        a.0 = h + 1 - (a.0 + r - 1);
        b.0 = h + 1 - (b.0 + r - 1);
    }
    let mut cnt = h * w;
    if a == b {
    } else {
        cnt -= r * c;
    }
    let ans = M::from(k).pow(cnt);
    println!("{}", ans);
}

fn main() {
    run();
}


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

fn exec() {
    let mut sc = Scanner::new();
    let s: Vec<u8> = sc.ne::<String>().into_bytes();
    let k: usize = sc.ne();
    let mut div = 1i64;
    for _ in 0..k {
        div *= 10;
    }
    let n = s.len();
    let mut mi = 100;
    for i in 0..(1 << n) {
        let mut a = Vec::new();
        for j in 0..n {
            if (1 << j) & i != 0 {
                a.push(s[j] - b'0');
            }
        }
        if a.is_empty() {
            continue;
        }
        if a.len() > 1 && a[0] == 0 {
            continue;
        }
        let score = n - (i as usize).count_ones() as usize;
        let mut val = 0i64;
        for j in 0..a.len() {
            val *= 10;
            val += a[j] as i64;
        }
        if val % div == 0 {
            mi = std::cmp::min(mi, score);
        }
    }
    println!("{}", mi);
}

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

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

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


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 s: usize = scan.next();
    let v1: usize = scan.next();
    let v2: usize = scan.next();
    let t1: usize = scan.next();
    let t2: usize = scan.next();
    let score1 = s * v1 + 2 * t1;
    let score2 = s * v2 + 2 * t2;
    if score1 == score2 {
        println!("Friendship");
    } else {
        println!("{}", if score1 < score2 { "First" } else { "Second" });
    }
}

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


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

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input)
        .expect("Failed to read line");
    let input = input.trim().split(" ").collect::<Vec<&str>>();

    let s = str_to_int(input[0]);
    let v1 = str_to_int(input[1]);
    let v2 = str_to_int(input[2]);
    let t1 = str_to_int(input[3]);
    let t2 = str_to_int(input[4]);

    let cli1 = s*v1 + 2*t1;
    let cli2 = s*v2 + 2*t2;

    if cli1 < cli2 {
        println!("First");
    } else if cli1 > cli2 {
        println!("Second");
    } else {
        println!("Friendship");
    }
}

fn str_to_int(a:&str) -> i32 {
    a.parse::<i32>().unwrap()
}


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

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

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

fn is_interesting(x: usize) -> bool {
    let mut aux = x;
    let mut dsum = 0usize;
    while aux > 0 {
        dsum += aux % 10;
        aux /= 10;
    }
    dsum % 4 == 0
}

fn _main() {
    let mut scan = Scan::new();
    let mut a: usize = scan.next();
    while !is_interesting(a) {
        a += 1;
    }
    println!("{}", a);
}

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


use std::io::stdin;

fn sum_dig(n: i32) -> i32 {
    let mut x = n;
    let mut s = 0;
    while x > 0 {
        s += x % 10;
        x /= 10;
    }
    s
}

fn main() {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf).unwrap();
    let n = buf.trim().trim_end().parse::<i32>().unwrap();
    let mut i = n;
    loop {
        if sum_dig(i) % 4 == 0 {
            println!("{}", i);
            break;
        }
        i += 1;
    }
}


fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n);
    let n: i32 = n.trim().parse().unwrap();
    // 1 2 3 4 5
    if n % 5 == 0 {
        println!("{:?}", n / 5);
    } else {
        println!("{:?}", n / 5 + 1);
    }
}


#![allow(unused)]
use std::io;

#[macro_export]
macro_rules! dbg {
    ($expr:expr) => {
        match $expr {
            expr => {
                eprintln!("{}: {} = {:#?}", line!(), stringify!($expr), &expr);
                expr
            }
        }
    };
    ($l:literal, $expr:expr) => {
        match $expr {
            expr => {
                eprintln!(concat!(line!(), ": ",
                    stringify!($expr), " = ", $l), &expr);
                ($l, expr)
            }
        }
    }
}

#[macro_export]
macro_rules! ternary { ($condition: expr, $_true: expr, $_false: expr) => { if $condition { $_true } else { $_false } };}

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).expect("");
    let x: u32 = input.trim().parse().expect("");
    println!("{}", x / 5 + ternary!(x % 5 > 0, 1, 0));
}


// https://codeforces.com/problemset/problem/337/A
use std::io;

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

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

    let words: Vec<i64> =
        line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    let n = words[0];

    let mut line = String::new();

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

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

    f.sort();

    let mut minima = 999;

    let iter = f.windows(n as usize);

    for x in iter {
        minima = std::cmp::min(minima, x.last().unwrap() - x[0]);
    }

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


fn main() {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);
    let line = line.trim();
    let v: Vec<i32> = line.trim().split(" ").map(|s| s.parse::<i32>().unwrap()).collect();

    let n = v[0] as usize;
    let mut line = String::new();
    std::io::stdin().read_line(&mut line);
    let line = line.trim();
    let mut v: Vec<i32> = line.trim().split(" ").map(|s| s.parse::<i32>().unwrap()).collect();

    v.sort();
    let mut ret = std::i32::MAX;
    for i in 0..v.len() - n + 1 {
        let tmp = v[i + n - 1] - v[i];
        ret = std::cmp::min(tmp, ret);
    }
    println!("{:?}", ret);

}


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

fn main() {
    let (w1, h1, w2, h2) = scan!(i64, i64, i64, i64);
    println!("{}", w1 + 2 * h1 + 4 + w2 + 2 * h2 + w1 - w2);
}


fn main() {
    let mut sin = String::new();
    std::io::stdin().read_line(&mut sin).expect("read error");
    let vi32: Vec<i32> = sin.split_whitespace().map(|c| c.parse().unwrap()).collect();
    let (w1, h1, w2, h2) = (vi32[0], vi32[1], vi32[2], vi32[3]);
    let ret = (h1 + h2) * 2 + (w1 + w2) + 4 + if w1 > w2 { w1 - w2 } else { 0 };
    println!("{}", ret);
}


fn main() {
    let mut text = String::new();
    std::io::stdin().read_line(&mut text).unwrap();
    let mut x = text.trim().parse::<u64>().unwrap();
    let mut xx = 0;
    while x > 0 {
        let d = x % 10;
        x = x / 10;
        if d == 7 || d == 4 {
            xx = xx + 1;
        }
    }
    if xx == 0 {
        println!("NO");
        return;
    }
    while xx > 0 {
        let d = xx % 10;
        xx = xx / 10;
        if d != 4 && d != 7 {
            println!("NO");
            return;
        }
    }
    println!("YES");
}


use std::io::stdin;

fn main() {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    let mut ans = 0;
    for i in buf.trim_end().chars() {
        if i == '4' || i == '7' {
            ans += 1;
        };
    }
    println!("{}", if ans == 4 || ans == 7 { "YES" } else { "NO" });
}


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

fn run() {
    let stdin = std::io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    let mut n: usize = sc.read();
    let k: usize = sc.read();
    for _ in 0..k {
        if n % 10 == 0 {
            n /= 10;
        } else {
            n -= 1;
        }
    }
    println!("{}", n);
}

fn main() {
    std::thread::Builder::new()
        .name("run".to_string())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap()
}

//{{{ utils
pub struct Scanner<R> {
    reader: R,
}

impl<R> Scanner<R> {
    pub fn new(r: R) -> Scanner<R> {
        Scanner { reader: r }
    }
}

fn is_whitespace(b: u8) -> bool {
    b == b' ' || b == b'\n' || b == b'\r' || b == b'\t'
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        let buf = std::io::Read::bytes(self.reader.by_ref())
            .map(|b| b.expect("Read failed"))
            .skip_while(|&b| is_whitespace(b))
            .take_while(|&b| !is_whitespace(b))
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error")
    }

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

    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

pub trait SetMinMax {
    fn set_min(&mut self, v: Self) -> bool;
    fn set_max(&mut self, v: Self) -> bool;
}

impl<T> SetMinMax for T
where
    T: PartialOrd,
{
    fn set_min(&mut self, v: T) -> bool {
        *self > v && {
            *self = v;
            true
        }
    }
    fn set_max(&mut self, v: T) -> bool {
        *self < v && {
            *self = v;
            true
        }
    }
}

#[derive(PartialEq, Eq, Debug, Copy, Clone, Default, Hash)]
pub struct Reverse<T>(pub T);

impl<T: PartialOrd> PartialOrd for Reverse<T> {
    #[inline]
    fn partial_cmp(&self, other: &Reverse<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }

    #[inline]
    fn lt(&self, other: &Self) -> bool {
        other.0 < self.0
    }
    #[inline]
    fn le(&self, other: &Self) -> bool {
        other.0 <= self.0
    }
    #[inline]
    fn ge(&self, other: &Self) -> bool {
        other.0 >= self.0
    }
    #[inline]
    fn gt(&self, other: &Self) -> bool {
        other.0 > self.0
    }
}

impl<T: Ord> Ord for Reverse<T> {
    #[inline]
    fn cmp(&self, other: &Reverse<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

#[allow(unused)] // This is defined for read! macro
fn readln() -> String {
    let mut line = String::new();
    ::std::io::stdin()
        .read_line(&mut line)
        .unwrap_or_else(|e| panic!("{}", e));
    line
}
//}}}