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_p546a(input: &mut Read, out: &mut Write) {
    let mut scanner = Scanner::new(input);
    let arr: Vec<usize> = scanner.next::<String>().split(' ').map(|e| {
        e.parse::<usize>().unwrap()
    }).collect();
    let k = arr[0];
    let n = arr[1];
    let w = arr[2];
    let mut s = 0;
    for i in 1..=w {
        s += i * k;
    }
    if s > n {
        write!(out, "{}", s - n).ok();
    } else {
        write!(out, "{}", 0).ok();
    }
}

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


use std::io;

fn main() {
	let mut inp = String::new();
	io::stdin().read_line(&mut inp).unwrap();
	let inp = inp.trim();
	let k: i32 = inp.split_whitespace().nth(0).unwrap().parse().unwrap();
	let n: i32 = inp.split_whitespace().nth(1).unwrap().parse().unwrap();
	let w: i32 = inp.split_whitespace().nth(2).unwrap().parse().unwrap();
	let mut all_money = 0;
	for i in 1..(w+1) {
		all_money += i*k;
	}
	if all_money - n <= 0 {
		println!("0");
	} else {
		println!("{}", all_money - n);
	}
}


use std::io;
use std::io::prelude::*;
fn main() {
    let mut inputnum = String::new();
    io::stdin().read_line(&mut inputnum).expect("Error");
    let result : Vec<i64> = inputnum.split_whitespace().map(|x| x.parse::<i64>().unwrap()).collect();
    let totalcost:i64= (result[0]*(result[2]*(result[2]+1)))/2;
    if totalcost>result[1]{
        println!("{}",totalcost-result[1]);
    }
    else{
        println!("0");
    }
}


use std::io;
use std::io::prelude::*;
use std::cmp;
macro_rules! scan {
    ( $string:expr, $( $x:ty ),+ ) => {{
        let mut iter = $string.split_whitespace();
        ($(iter.next().and_then(|word| word.parse::<$x>().ok()).unwrap(),)*)
    }}
}

fn main(){

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

    let mut it= s.split_whitespace();
    let (k,n,w)= scan!(s,i64,i64,i64);

    let r =cmp::max(0i64, (w*(w+1))/2 *k -n);
    print!("{}",r);

}


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

fn main() -> io::Result<()> {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input)?;
    let mut ts = input.split_whitespace();
    let k : i64 = ts.next().expect("a").parse().expect("b");
    let n : i64 = ts.next().expect("c").parse().expect("d");
    let w : i64 = ts.next().expect("e").parse().expect("f");
    let a = (w * (w + 1) / 2 * k - n).max(0);
    println!("{}", a);
    Ok(())
}


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

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

    let sum = (0..2).fold(0, |s,_| s + input.i().abs());
    let s = input.i();
    if s >= sum && (s - sum) % 2 == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

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

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

fn _main() {
    let mut scan = Scan::new();
    let a: isize = scan.next();
    let b: isize = scan.next();
    let s: isize = scan.next();
    let x = a.abs() + b.abs();
    let result: bool = s >= x && (s - x) % 2 == 0;
    println!("{}", if result { "Yes" } else { "No" });
}

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


use std::io;

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

fn main() {
    let (mut n,) = parse_line!(u32);
    if n % 2 != 0 {
        println!("{}", 0);
        return;
    }
    n /= 2;
    println!("{}", n / 2 - ((n % 2) ^ 1));
}


//spnauti-rusT
use std::io::*;
use std::str::{self,*};
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_macros)]
macro_rules! m {
    ($c:tt, $x:expr, $y:expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
#[allow(unused_macros)]
macro_rules! l {
    ($($v:ident),* = $i:ident.$f:ident $a:tt) => {
        $( let $v = $i.$f$a; )*
    };
    ($($v:ident),*:$t:ty = $i:ident.$f:ident $a:tt) => {
        $( let $v:$t = $i.$f$a; )*
    };
}
struct WordReader<'a> { it : SplitAsciiWhitespace<'a> }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).ok();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn f(&mut self) ->    f64 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn sk(&mut self, n: usize) { self.it.nth(n - 1); }
    fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> {
        self.ip(n).into_iter()
    }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
        self.vp(n).into_iter()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}
//------------------- End rusT

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

    let n = input.i();
    let sol = if n % 2 == 1 {
        0
    } else {
        (n - 2) / 4
    };
    println!("{}", sol);
}


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

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

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

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

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

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 mod_pow(x:i64, n:i64, m:i64) -> i64 {
    let mut x = x;
    let mut n = n;
    let mut res = 1i64;
    while n > 0 {
        if n & 1 > 0 {
            res = res * x % m;
        }
        x = x * x % m;
        n >>= 1;
    }
    res
}

fn main() {
    input!{n:i64};
    if n%2 != 0 {
        println!("0");
        return();
    }
    println!("{}", (n/2-1)/2);
}


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

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

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

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

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

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

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

fn main() {
    let (n, k) = scan_line!(u64 usize);
    let mut factors = vec![];

    let mut i = 1;

    while i*i <= n {
        if n % i == 0 {
            factors.push(i);
        }
        i += 1;
    }

    for j in 0..factors.len() {
        let x = n / factors[j];
        factors.push(x);
    }
    factors.sort();
    factors.dedup();

    if k - 1 >= factors.len() {
        println!("-1");
    } else {
        println!("{}", factors[k - 1]);
    }
}


use std::collections::LinkedList;

macro_rules! read_line {
    ($v:ident) => {
        let mut temp = String::new();
        std::io::stdin().read_line(&mut temp).unwrap();
        let $v = temp;
    };
    (var, $t:ty, $($v:ident), *) => {
        read_line!(input_line);
        let mut iter = parse_token!($t, input_line);
        $(
            let $v = iter.next().unwrap();
        )*
    };
    (vec, $t:ty, $v:ident) => {
        read_line!(input_line);
        let iter = parse_token!($t, input_line);
        let $v: Vec<$t> = iter.collect();
    };
    ($($v:ident; $t:ty), *) => {
        read_line!(input_line);
        let mut iter = input_line.split_whitespace();
        $(
            let $v: $t = iter.next().unwrap().parse().unwrap();
        )*
    };
}

macro_rules! parse_token {
    ($t:ty, $e:expr) => {
        $e.split_whitespace().map(|x| x.parse::<$t>().unwrap());
    };
}

fn main() {
    read_line!(k;u64, n;u64);
    let mut divisors = LinkedList::new();
    let mut i = (k as f64).sqrt() as u64;
    if i * i == k {
        divisors.push_back(i);
        i -= 1;
    }
    while i >= 1 {
        if k % i == 0 {
            divisors.push_front(i);
            divisors.push_back(k / i);
        }
        i -= 1;
    }
    if n > divisors.len() as u64 {
        println!("-1");
    } else {
        for (idx, divisor) in divisors.iter().enumerate() {
            if idx as u64 == n - 1 {
                println!("{}", divisor);
            }
        }
    }
}


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

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

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

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

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

fn kth_smallest_divisor(n: i64, k: i64) -> i64 {
    let k = k as usize;
    let divisors = get_divisors(n);
    if k >= divisors.len() {
        return -1;
    }
    divisors[k]
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n: i64 = scan.token();
    let k: i64 = scan.token();
    let ans = kth_smallest_divisor(n, k - 1);
    writeln!(out, "{}", ans).ok();
}

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


use std::io;

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

    let input: Vec<i64>  = input_str.split_whitespace()
        .map(|x| x.parse::<i64>().expect("parse error"))
        .collect();

    let n = input[0];
    let k = input[1];

    let mut divisors: Vec<i64> = vec![];
    for divisor in 1..n+1 {
        if divisor * divisor > n { break; }
        if n % divisor == 0 { divisors.push(divisor); }
    }

    let another_divisors: Vec<i64>;
    another_divisors = divisors.iter().map(|x| n / x).filter(|x| x * x != n).rev().collect();

    divisors.extend(another_divisors);

    if (divisors.len() as i64) < k {
        println!("-1");
    } else {
        println!("{}", divisors[k as usize - 1]);
    }
}


fn calculate_nth_divisor(n: i64, k: i64) -> Option<i64> {
    if k > n {
        return None;
    }

    let mut divisors = Vec::<i64>::new();
    let max_small_divisor = (n as f64).sqrt().trunc() as i64;
    let mut count = k;

    for x in 1..=max_small_divisor {
        if n % x == 0 {
            count -= 1;
            divisors.push(x);
        }
        if count == 0 {
            return Some(x);
        }
    }

    let size = divisors.len() as i64;
    let n_is_square = n == divisors.last().unwrap().pow(2);
    if count > size || count == size && n_is_square {
        None
    } else {
        let mut idx = (size as i64 - count) as usize;
        if n_is_square {
            idx -= 1;
        }
        Some(n / divisors[idx])
    }
}

fn main() {
    let (n, k) = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let mut iter = s.trim().split_ascii_whitespace();
        let n = iter.next().unwrap().parse::<i64>().unwrap();
        let k = iter.next().unwrap().parse::<i64>().unwrap();
        (n, k)
    };

    println!("{}", calculate_nth_divisor(n, k).unwrap_or(-1));
}


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

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

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

fn run() {
    input! {
        n: u64,
        k: usize1,
    }
    let mut a = vec![];
    for d in 1u64.. {
        if d * d > n {
            break;
        }
        if n % d == 0 {
            a.push(d);
            a.push(n / d);
        }
    }
    a.sort();
    a.dedup();
    if let Some(d) = a.get(k) {
        println!("{}", *d);
    } else {
        println!("-1");
    }
}

fn main() {
    run();
}


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

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

fn main() {
    let n: u64 = get();
    let k: u32 = get();
    let mut fact = Vec::new();
    {
        let mut i = 1;
        while i * i <= n {
            if n % i == 0 {
                fact.push(i);
                if i * i != n {
                    fact.push(n / i);
                }
            }
            i += 1;
        }
    }
    fact.sort();
    if (fact.len() as u32) < k {
        println!("-1");
    } else {
        println!("{}", fact[k as usize - 1]);
    }
}


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

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

	let n = rin.u();
	let mut c = v!([n+1] = 0);
	for (a,b,v) in vec![(n/2+1,n,1),(1,n/2,-1),(1,2,-1),(1,n/2-1,2)] {
		for i in a..=b {
			let mut x = i;
			for j in 2..=n {
				while x % j == 0 {
					x /= j;
					c[j] += v;
				}
			}
		}
	}
	let mut sol = 1_i64;
	for i in 2..=n {
		rep!{[c[i]]
			sol *= i as i64;
		}
	}
	writeln!(rout, "{}", sol).ok();
}


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

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

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());
    let n = scan.next::<u128>() / 2;

    let mut res = 1;

    for i in 1..n {
        res *= i;
        res *= i + n;
    }
    println!("{:?}", res);
}


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

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

struct Ios(Vec<char>);

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

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

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

struct Iov<T>(Vec<T>);

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

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

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

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

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

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

    let ans = (1..=(n - 1)).fold(1, |acc, i| acc * i) / (n / 2);
    writeln!(writer, "{}", ans).ok();
}

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


// -*- coding:utf-8-unix -*-

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

use std::cmp::*;
use std::collections::*;
use std::fs::File;
use std::io::prelude::*;
use std::io::*;
use std::mem;
use std::str;
use std::vec;

const INF: i64 = 1223372036854775807;
const MEM_SIZE: usize = 202020;
const MOD: i64 = 1000000007;
// const MOD: i64 = 998244353;

use std::cmp::*;
use std::collections::*;
use std::io::stdin;
use std::io::stdout;
use std::io::Write;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn readi() -> (i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    iter.next().unwrap().parse::<i64>().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(dead_code)]
fn readii() -> (i64, i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
    )
}

#[allow(dead_code)]
fn readiii() -> (i64, i64, i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
    )
}
#[allow(dead_code)]
fn readuu() -> (usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

fn readcc() -> (char, char) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<char>().unwrap(),
        iter.next().unwrap().parse::<char>().unwrap(),
    )
}

#[allow(dead_code)]
fn readuuu() -> (usize, usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

#[allow(dead_code)]
fn readuuuu() -> (usize, usize, usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

fn solve() {
    let n: usize = read();
    if n == 2 {
        println!("{:?}", 1);
        return;
    }
    let mut res: u64 = 1;
    for i in 0..n / 2 {
        res *= (n - i) as u64;
        res /= (1 + i) as u64;
    }
    res /= 2;
    for i in 0..(n / 2) - 1 {
        res *= (i + 1) as u64;
        res *= (i + 1) as u64;
    }
    println!("{}", res);
    return;
}

fn main() {
    solve()
}


use std::io::{self, BufRead};                   // (a)
// use array2d::Array2D;
use std::cmp::{min, max};

macro_rules! numsin {
    () => (
        io::stdin().lock()                           // (0)
              .lines().next().unwrap().unwrap() // (1)
              .split(' ').map(|s| s.trim())     // (2)
              .filter(|s| !s.is_empty())        // (3)
              .map(|s| s.parse().unwrap())      // (4)
              .collect()
    )
}

fn calc_remain(left: i64, k: i64, l: i64, r: i64, a: i64) -> (i64, i64, i64, i64) {
    if (r - l) * k + left < a {
        return (-1, -1, -1, -1);
    }
    let ck = max(0, ((a - left) + k - 1) / k);
    let remain = k * ck + left - a;
    if ck + l < r {
        return (ck, remain, ck+1, k);
    }
    else {
        return (ck, remain, -1, -1);
    }
}

fn main() {
    let n: Vec<u64> = numsin!();
    let n = n[0];
    let mut d1: u64 = 1;
    let mut d2: u64 = 1;
    for i in 0..n/2 {
        d1 = d1 * (n - i);
        d2 = d2 * (i + 1);
    }
    println!("{}", d1 / (n / 2) * d2 / (n / 2) / 2);
}


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

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

fn main() {
    let n = get!(u64);
    let mut a = 1;
    let mut q = n;
    for i in 0..n / 2 {
        a *= q;
        q -= 1;
    }
    let mut b = 1;
    for i in (1..((n / 2) + 1)).rev() {
        b *= i;
    }
    let mut c = 1;
    for i in 1..(n / 2) {
        c *= i;
    }
    mydbg!(a, b, c);
    echo!((a / b) / 2 * c * c);
}


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

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

macro_rules! read_value {
    ($next:expr, [graph1; $len:expr]) => {{
        let mut g = vec![vec![]; $len];
        let ab = read_value!($next, [(usize1, usize1)]);
        for (a, b) in ab {
            g[a].push(b);
            g[b].push(a);
        }
        g
    }};
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => (read_value!($next, usize) - 1);
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        read_value!($next, [$t; len])
    }};
    ($next:expr, $t:ty) => ($next().parse::<$t>().expect("Parse error"));
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    #[allow(unused)]
    macro_rules! putvec {
        ($v:expr) => {
            for i in 0..$v.len() {
                puts!("{}{}", $v[i], if i + 1 == $v.len() {"\n"} else {" "});
            }
        }
    }
    input!(n: usize);
    let mut dp = vec![vec![0u64; n + 1]; n + 1];
    dp[0][0] = 1;
    for i in 1..n + 1 {
        for j in 0..n + 1 {
            dp[i][j] = dp[i - 1][j];
            if j > 0 {
                dp[i][j] += dp[i - 1][j - 1];
            }
        }
    }
    let mut k = dp[n][n / 2] / 2;
    for i in 1..n / 2 {
        k *= i as u64;
        k *= i as u64;
    }
    puts!("{}\n", k);
}

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


pub trait Zero: PartialEq + Sized {
    fn zero() -> Self;
    #[inline]
    fn is_zero(&self) -> bool {
        self == &Self::zero()
    }
}
pub trait One: PartialEq + Sized {
    fn one() -> Self;
    #[inline]
    fn is_one(&self) -> bool {
        self == &Self::one()
    }
}
macro_rules ! zero_one_impls { ($ ({ $ Trait : ident $ method : ident $ ($ t : ty) *, $ e : expr }) *) => { $ ($ (impl $ Trait for $ t { # [inline] fn $ method () -> Self { $ e } }) *) * } ; }
zero_one_impls ! ({ Zero zero u8 u16 u32 u64 usize i8 i16 i32 i64 isize u128 i128 , 0 } { Zero zero f32 f64 , 0. } { One one u8 u16 u32 u64 usize i8 i16 i32 i64 isize u128 i128 , 1 } { One one f32 f64 , 1. }) ;
#[macro_export]
macro_rules ! min { ($ e : expr) => { $ e } ; ($ e : expr , $ ($ es : expr) ,+) => { std :: cmp :: min ($ e , min ! ($ ($ es) ,+)) } ; }
#[macro_export]
macro_rules ! chmin { ($ dst : expr , $ ($ src : expr) ,+) => { { let x = std :: cmp :: min ($ dst , min ! ($ ($ src) ,+)) ; $ dst = x ; } } ; }
#[macro_export]
macro_rules ! max { ($ e : expr) => { $ e } ; ($ e : expr , $ ($ es : expr) ,+) => { std :: cmp :: max ($ e , max ! ($ ($ es) ,+)) } ; }
#[macro_export]
macro_rules ! chmax { ($ dst : expr , $ ($ src : expr) ,+) => { { let x = std :: cmp :: max ($ dst , max ! ($ ($ src) ,+)) ; $ dst = x ; } } ; }
pub trait IterScan: Sized {
    type Output;
    fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output>;
}
pub trait MarkedIterScan: Sized {
    type Output;
    fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output>;
}
#[derive(Clone, Debug)]
pub struct Scanner<'a> {
    iter: std::str::SplitAsciiWhitespace<'a>,
}
mod scanner_impls {
    use super::*;
    impl<'a> Scanner<'a> {
        #[inline]
        pub fn new(s: &'a str) -> Self {
            let iter = s.split_ascii_whitespace();
            Self { iter }
        }
        #[inline]
        pub fn scan<T: IterScan>(&mut self) -> <T as IterScan>::Output {
            <T as IterScan>::scan(&mut self.iter).expect("scan error")
        }
        #[inline]
        pub fn mscan<T: MarkedIterScan>(&mut self, marker: T) -> <T as MarkedIterScan>::Output {
            marker.mscan(&mut self.iter).expect("scan error")
        }
        #[inline]
        pub fn scan_vec<T: IterScan>(&mut self, size: usize) -> Vec<<T as IterScan>::Output> {
            (0..size)
                .map(|_| <T as IterScan>::scan(&mut self.iter).expect("scan error"))
                .collect()
        }
        #[inline]
        pub fn iter<'b, T: IterScan>(&'b mut self) -> ScannerIter<'a, 'b, T> {
            ScannerIter {
                inner: self,
                _marker: std::marker::PhantomData,
            }
        }
    }
    macro_rules ! iter_scan_impls { ($ ($ t : ty) *) => { $ (impl IterScan for $ t { type Output = Self ; # [inline] fn scan <'a , I : Iterator < Item = &'a str >> (iter : & mut I) -> Option < Self > { iter . next () ?. parse ::<$ t > () . ok () } }) * } ; }
    iter_scan_impls ! (char u8 u16 u32 u64 usize i8 i16 i32 i64 isize f32 f64 u128 i128 String) ;
    macro_rules ! iter_scan_tuple_impl { ($ ($ T : ident) *) => { impl <$ ($ T : IterScan) ,*> IterScan for ($ ($ T ,) *) { type Output = ($ (<$ T as IterScan >:: Output ,) *) ; # [inline] fn scan <'a , It : Iterator < Item = &'a str >> (_iter : & mut It) -> Option < Self :: Output > { Some (($ (<$ T as IterScan >:: scan (_iter) ?,) *)) } } } ; }
    iter_scan_tuple_impl!();
    iter_scan_tuple_impl!(A);
    iter_scan_tuple_impl ! (A B) ;
    iter_scan_tuple_impl ! (A B C) ;
    iter_scan_tuple_impl ! (A B C D) ;
    iter_scan_tuple_impl ! (A B C D E) ;
    iter_scan_tuple_impl ! (A B C D E F) ;
    iter_scan_tuple_impl ! (A B C D E F G) ;
    iter_scan_tuple_impl ! (A B C D E F G H) ;
    iter_scan_tuple_impl ! (A B C D E F G H I) ;
    iter_scan_tuple_impl ! (A B C D E F G H I J) ;
    iter_scan_tuple_impl ! (A B C D E F G H I J K) ;
    pub struct ScannerIter<'a, 'b, T> {
        inner: &'b mut Scanner<'a>,
        _marker: std::marker::PhantomData<fn() -> T>,
    }
    impl<'a, 'b, T: IterScan> Iterator for ScannerIter<'a, 'b, T> {
        type Item = <T as IterScan>::Output;
        #[inline]
        fn next(&mut self) -> Option<Self::Item> {
            <T as IterScan>::scan(&mut self.inner.iter)
        }
    }
}
pub mod marker {
    use super::*;
    use std::{iter::FromIterator, marker::PhantomData};
    #[derive(Debug, Copy, Clone)]
    pub struct Usize1;
    impl IterScan for Usize1 {
        type Output = usize;
        #[inline]
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output> {
            Some(<usize as IterScan>::scan(iter)?.checked_sub(1)?)
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct Chars;
    impl IterScan for Chars {
        type Output = Vec<char>;
        #[inline]
        fn scan<'a, I: Iterator<Item = &'a str>>(iter: &mut I) -> Option<Self::Output> {
            Some(iter.next()?.chars().collect())
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct CharsWithBase(pub char);
    impl MarkedIterScan for CharsWithBase {
        type Output = Vec<usize>;
        #[inline]
        fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output> {
            Some(
                iter.next()?
                    .chars()
                    .map(|c| (c as u8 - self.0 as u8) as usize)
                    .collect(),
            )
        }
    }
    #[derive(Debug, Copy, Clone)]
    pub struct Collect<T: IterScan, B: FromIterator<<T as IterScan>::Output>> {
        size: usize,
        _marker: PhantomData<fn() -> (T, B)>,
    }
    impl<T: IterScan, B: FromIterator<<T as IterScan>::Output>> Collect<T, B> {
        pub fn new(size: usize) -> Self {
            Self {
                size,
                _marker: PhantomData,
            }
        }
    }
    impl<T: IterScan, B: FromIterator<<T as IterScan>::Output>> MarkedIterScan for Collect<T, B> {
        type Output = B;
        #[inline]
        fn mscan<'a, I: Iterator<Item = &'a str>>(self, iter: &mut I) -> Option<Self::Output> {
            Some(
                (0..self.size)
                    .map(|_| <T as IterScan>::scan(iter).expect("scan error"))
                    .collect::<B>(),
            )
        }
    }
}
fn main() {
    #![allow(unused_imports, unused_macros)]
    use std::io::{stdin, stdout, BufWriter, Read as _, Write as _};
    let mut _in_buf = Vec::new();
    stdin().read_to_end(&mut _in_buf).expect("io error");
    let _in_buf = unsafe { String::from_utf8_unchecked(_in_buf) };
    let mut scanner = Scanner::new(&_in_buf);
    macro_rules ! scan { () => { scan ! (usize) } ; (($ ($ t : tt) ,*)) => { ($ (scan ! ($ t)) ,*) } ; ([$ t : tt ; $ len : expr]) => { (0 ..$ len) . map (| _ | scan ! ($ t)) . collect ::< Vec < _ >> () } ; ([$ t : ty ; $ len : expr]) => { scanner . scan_vec ::<$ t > ($ len) } ; ([$ t : ty]) => { scanner . iter ::<$ t > () } ; ({ $ e : expr }) => { scanner . mscan ($ e) } ; ($ t : ty) => { scanner . scan ::<$ t > () } ; }
    let _out = stdout();
    let mut _out = BufWriter::new(_out.lock());
    macro_rules ! print { ($ ($ arg : tt) *) => (:: std :: write ! (_out , $ ($ arg) *) . expect ("io error")) }
    macro_rules ! println { ($ ($ arg : tt) *) => (:: std :: writeln ! (_out , $ ($ arg) *) . expect ("io error")) }
    macro_rules! echo {
        ($ iter : expr) => {
            echo!($iter, '\n')
        };
        ($ iter : expr , $ sep : expr) => {
            let mut iter = $iter.into_iter();
            if let Some(item) = iter.next() {
                print!("{}", item);
            }
            for item in iter {
                print!("{}{}", $sep, item);
            }
            println!();
        };
    }
    let n = scan!();
    let mut ans = 1u128;
    for i in 0..n as u128 / 2 {
        ans = ans * (n as u128 - i) / (i + 1);
    }
    ans /= 2;
    let mut r = 1;
    for i in 1..n as u128 / 2 {
        r *= i;
    }
    ans *= r * r;
    println!("{}", ans);
}


use std::io::stdin;

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

fn main() {
    let (n, k) = {
        let i = get_in();
        let i: Vec<i64> = i.trim().split(" ").map(|x| x.parse().unwrap()).collect();
        (i[0], i[1])
    };
    if (n / k) % 2 != 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

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

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

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

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

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

fn main() {
  scanln!(n: u64, k: u64);
  if (n / k) % 2 == 0 {
    println!("NO");
  } else {
    println!("YES");
  }
}


#[allow(unused_imports)]
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet};
use std::io::{stdin, stdout, BufWriter, Write};
const BITS: usize = 19;

#[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 solve () {
    let mut scan = Scanner::default();
    let n: u64 = scan.next ();
    let k: u64 = scan.next ();
    let m = n/k;
    println! ("{}", if m%2 == 1 {"YES"} else {"NO"});
}

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


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

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

    let a: i64 = input.p();
    let b: i64 = input.p();
    if a / b % 2 == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

fn main() {
    let mut nk = String::new();
    io::stdin().read_line(&mut nk).expect("");
    let nk: Vec<&str> = nk.trim().split(" ").collect();
    let n: u64 = nk[0].parse().expect("");
    let k: u64 = nk[1].parse().expect("");
    if (n / k) & 1 == 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

fn read_line() -> Vec<i64> {

  let mut buf = String::new();
  io::stdin().read_line(&mut buf).unwrap();
  return buf.trim().split(" ")
    .map(|x| {x.parse::<i64>().unwrap() })
    .collect();
}

fn main (){
  let line = read_line();
  let (a, b) = (line[0], line[1]);
  let x = a/b;

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


use std::io;

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

fn main() {
    let (n, k) = parse_line!(u64, u64);
    println!("{}", if n / k % 2 == 1 { "YES" } else { "NO" })
}


use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s)
        .expect("failed to read l2");

    let values = s
        .split_whitespace()
        .map(|x| x.parse::<u64>())
        .collect::<Result<Vec<u64>, _>>()
        .unwrap();

    assert!(values.len() == 2);
    let n = values[0];
    let k = values[1];

    if n <= k {
        println!("YES");
    } else {
        let plays = n / k;
        if plays % 2 == 1{
            println!("YES");
        } else {
            println!("NO")
        }
    }

}


use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let s = buf.trim().parse::<i64>().unwrap();
    let r = match s {
        s if s % 2 == 0 => s - s / 2,
        _ => -(s / 2 + 1),
    };

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


use std::io;
use std::io::{Write};
use std::str;

/// Reads white-space separated tokens one at a time.
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![],
        }
    }

    /// Use "turbofish" syntax token::<T>() to select data type of next token.
    ///
    /// # Panics
    ///
    /// Panics if there's an I/O error or if the token cannot be parsed as T.
    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();
        }
    }
}

/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: str::SplitAsciiWhitespace<'static>,
}

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

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

pub fn scanner_from_file(filename: &str) -> Scanner<io::BufReader<std::fs::File>> {
    let file = std::fs::File::open(filename).expect("Input file not found");
    Scanner::new(io::BufReader::new(file))
}

pub fn writer_to_file(filename: &str) -> io::BufWriter<std::fs::File> {
    let file = std::fs::File::create(filename).expect("Output file not found");
    io::BufWriter::new(file)
}

fn solve() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());
    let  n = scan.token::<i64>();
    let mut ans = n / 2;
    if n % 2 == 1 {
        ans = -ans-1;
    }
    out.write(format!("{}", ans).as_bytes()).unwrap();
    // let k = scan.token::<i32>();
    // let mut arr = scan.token::<String>().chars().collect::<Vec<char>>();
}

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


use std::io::stdin;

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

    if n%2 == 0 {
        println!("{}", n/2);
    } else {
        println!("{}",(n+1)/2*-1);
    }
}


use std::io;

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

fn read_line_val() -> i64 {
    return read_line().parse().unwrap();
}

fn f(k: i64) -> i64 {
    let mut res: i64 = 0;
    let mut n = k;
    loop {
        if n == 0 {
            break;
        }
        if n % 2 == 0 {
            res += n;
        } else {
            res -= n;
        }
        n -= 1;
    }
    return res;

}

fn f_(k: i64) -> i64 {
    let r = (k + 1) / 2;
    if k % 2 == 1 {
        return -r;
    }
    return r;
}

fn main() {
    let mut n = read_line_val();

    // for i in 1..n {
    //     let res = f(i);
    //     // let res_ = f_ (i);
    //     println!("{} -> {} - {}", i, res, res_);
    // }

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

}


use std::str::FromStr;

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

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

fn main() {
    let n: u64 = read_int();

    if n % 2 == 0 { println!("{}", n / 2); }
    else { println!("-{}", (n + 1) / 2); }
}


//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.s().parse::<i64>().unwrap();
    let sol = if n % 2 == 0 {
        n / 2
    } else {
        n / 2 - n
    };
    println!("{}", sol);
}


//! http://codeforces.com/contest/486/problem/A

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

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

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

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

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

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

fn main() {
  scanln!(n: u64);
  let mut res = ((n + 1) / 2) as i64;
  res *= if n % 2 == 0 { 1 } else { -1 };
  println!("{}", res);
}


use std::io::*;

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

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

    let n: f64 = read(sin);

    let ans = (n / 2.).ceil() as i64;

    println!("{}", if n as i64 % 2 == 0 { ans } else { -1 * ans });
}


use std::io;

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

fn main() {

    let luckies = vec![4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777];
    let n = read_line().trim().parse::<u32>().unwrap();

    if luckies.into_iter().any(|v| n % v == 0) {
        println!("YES");
    } else {
        println!("NO");
    }
}


//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();
    let a = [4,7,44,47,74,77,444,447,474,477,744,747,774,777];
    let sol = if a.iter().any(|d| n % d == 0) {
        "YES"
    } else {
        "NO"
    };
    println!("{}", sol);
}


use std::io;

fn main() {
    let mut ns = String::new();
    io::stdin().read_line(&mut ns).unwrap();
    let n: u16 = ns.trim().parse::<u16>().unwrap();
    let lucky: bool = ns.trim().replace("4","").replace("7","").len() == 0;
    if lucky {
        println!("YES");
        return;
    }
    let nums = [4,7,44,47,74,77,444,447,474,477,744,747,774,777];
    for ni in nums.iter() {
        if n % ni == 0 {
            println!("YES");
            return;
        }
    }
    println!("NO");
    return;
}


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

static LUCKY: &[u64] = &[4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777];

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

    stdin.lock().read_line(&mut input).unwrap();

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

    if is_almost_lucky(n) {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn is_almost_lucky(n: u64) -> bool {
    for lucky in LUCKY {
        if n % lucky == 0 {
            return true;
        }
    }
    false
}


use std::io;

fn main() {
    let mut ns = String::new();
    io::stdin().read_line(&mut ns).unwrap();
    let n: u16 = ns.trim().parse::<u16>().unwrap();
    let nums = [4,7,44,47,74,77,444,447,474,477,744,747,774,777];
    for ni in nums.iter() {
        if n % ni == 0 {
            println!("YES");
            return;
        }
    }
    println!("NO");
    return;
}


use std::io;

fn is_lucky(n: u32) -> bool {
    let decimal = format!("{}", n);
    decimal.chars().all(|x| x == '4' || x == '7')
}

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

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

    let n : i64 = n.trim().parse().unwrap();

    let mut lucky = Vec::<i64>::new();

    for i in 1..1001 {
        if is_lucky(i) {
            lucky.push(i as i64);
        }
    }

    let mut flag = false;

    for d in lucky {
        if n % d == 0 {
            flag = true;
        }
    }

    if flag {
        println!("YES");
    } else {
        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_p122a(input: &mut Read, out: &mut Write) {
    let mut scanner = Scanner::new(input);
    let num = scanner.next::<String>().parse::<usize>().unwrap();
    let lucky_nums = vec![4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777];
    if is_almose_lucky(num, lucky_nums) {
        write!(out, "YES").ok();
    } else {
        write!(out, "NO").ok();
    }
}

fn is_almose_lucky(num: usize, arr: Vec<usize>) -> bool {
    if arr.contains(&num) {
        return true;
    }
    for item in &arr {
        if num % (*item) == 0 {
            return true;
        }
    }
    return false;
}

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


fn main(){
    let mut line=String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let line=line.trim().parse::<i32>().unwrap();
    let luck=[4,7,44,47,74,77,444,447,474,477,744,747,774,777];
    for c in &luck{
        if line%c==0{
            print!("YES");
            return
        }
    }
    print!("NO")
}


fn main() {
    let mut ri = ReadIn::new();
    let n = ri.int();
    ri.read_line();
    let s = ri.0;
    let mut c1 = 0;
    let mut c2 = 0;
    for c in s.chars() {
        if c == 'L' {
            c1 -= 1;
        }
        if c == 'R' {
            c1 += 1;
        }
        if c == 'U' {
            c2 -= 1;
        }
        if c == 'D' {
            c2 += 1;
        }
    }
    if c1 < 0 {
        c1 = -c1;
    }
    if c2 < 0 {
        c2 = -c2;
    }
    println!("{}", n - c1 - c2);
}

use std::iter::Map;
use std::str::SplitWhitespace;
use std::io::stdin;
use std::mem::forget;

pub struct ReadIn(pub String);

impl ReadIn {
    pub fn new() -> ReadIn {
        ReadIn(String::new())
    }
    fn read_i32(s: &str) -> i32 {
        s.parse().unwrap()
    }
    pub fn read_line(&mut self) {
        self.0.clear();
        forget(stdin().read_line(&mut self.0));
    }
    pub fn ints(&mut self) -> Map<SplitWhitespace, fn(&str) -> i32> {
        self.read_line();
        self.0.split_whitespace().map(ReadIn::read_i32)
    }
    pub fn int(&mut self) -> i32 {
        self.ints().next().unwrap()
    }
    pub fn int2(&mut self) -> (i32, i32) {
        let mut it = self.ints();
        (it.next().unwrap(), it.next().unwrap())
    }
}


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

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

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

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

fn max_moves(moves : &str) -> usize {
    let lrud = "LRUD".as_bytes();
    let left = lrud[0];
    let right = lrud[1];
    let up = lrud[2];
    let down = lrud[3];
    let mut num_left = 0;
    let mut num_right = 0;
    let mut num_up = 0;
    let mut num_down = 0;
    for &b in moves.as_bytes().iter() {
        if b == left {
            num_left = num_left + 1;
        } else if b == right {
            num_right = num_right + 1;
        } else if b == up {
            num_up = num_up + 1;
        } else if b == down {
            num_down = num_down + 1;
        } else {
            panic!("Unknown move!");
        }
    }
    let x = min(num_left, num_right);
    let y = min(num_up, num_down);
    x + x + y + y
}

fn main() {
    let stdin = io::stdin();
    let _ : usize = read_t(&stdin);
    let mut moves = String::new();
    read_line(&stdin, &mut moves);
    let moves = moves.trim();
    let x = max_moves(moves);
    println!("{}", x);
}


use std::cmp::min;
use std::io::stdin;
fn main() {
    let mut _text = String::new();
    stdin().read_line(&mut _text).unwrap();
    let (uc, dc, rc, lc) = command_counter(parse());
    let counter = min(uc, dc) * 2 + min(lc, rc) * 2;
    println!("{}", counter)
}
#[derive(Debug, Copy, Clone)]
enum Command {
    U,
    D,
    L,
    R,
}

fn parse() -> Vec<Command> {
    let mut text = String::new();
    stdin().read_line(&mut text).unwrap();
    let fu = |e: char| -> Command {
        match e {
            'U' => Command::U,
            'D' => Command::D,
            'L' => Command::L,
            _ => Command::R,
        }
    };
    let text: Vec<Command> = text.trim().chars().map(fu).collect();
    text
}
fn command_counter(arr: Vec<Command>) -> (usize, usize, usize, usize) {
    let mut uc = 0;
    let mut dc = 0;
    let mut lc = 0;
    let mut rc = 0;
    for i in arr {
        match i {
            Command::U => uc += 1,
            Command::D => dc += 1,
            Command::L => lc += 1,
            Command::R => rc += 1,
        }
    }
    (uc, dc, rc, lc)
}


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

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

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

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

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

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

fn main() {
    let _n = get!(usize);
    let seq: Vec<char> = util::line().chars().collect();

    let l = seq.iter().filter(|&&c| c == 'L').count();
    let r = seq.iter().filter(|&&c| c == 'R').count();
    let u = seq.iter().filter(|&&c| c == 'U').count();
    let d = seq.iter().filter(|&&c| c == 'D').count();

    println!("{}", 2 * min(l, r) + 2 * min(u, d));
}


use std::collections::HashMap;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        _n: usize,
        commands: chars,
    }

    let mut num_command = HashMap::new();

    commands
        .iter()
        .for_each(|x| *num_command.entry(x).or_insert(0) += 1);

    let num_l = *num_command.get(&'L').unwrap_or(&0);
    let num_r = *num_command.get(&'R').unwrap_or(&0);
    let num_u = *num_command.get(&'U').unwrap_or(&0);
    let num_d = *num_command.get(&'D').unwrap_or(&0);

    println!(
        "{}",
        std::cmp::min(num_l * 2, num_r * 2) + std::cmp::min(num_u * 2, num_d * 2)
    );
}


use std::io;
use std::io::Read;
// use std::collections::VecDeque;

fn main() {
    let mut input_text = String::new();
    io::stdin().read_to_string(&mut input_text).unwrap();
    let mut iter = input_text.split_whitespace().map(|x| x.parse::<i32>().unwrap());
    let year = iter.next().unwrap();
    let mut new_year = year;
    let mut acc = 0;
    loop {
        new_year += 1;
        acc += if is_leap(new_year) {366 % 7} else {365 % 7};
        if acc >= 7 {
            acc -= 7;
        }
        // println!("year = {}, acc = {}", new_year, acc);
        if acc == 0 && is_leap(year) == is_leap(new_year) {
            break;
        }
    }
    println!("{}", new_year);

}

fn is_leap(year: i32) -> bool {
    year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)
}


fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let y: u32 = s.trim().parse().unwrap();
    let leap = |x: u32| -> bool {
        x % 400 == 0 || (x % 4 == 0 && x % 100 != 0)
    };
    let mut p = 1 + leap(y) as usize;
    let mut q = y + 1;
    while p != 0 || leap(q) != leap(y) {
        p = (p + 1) % 7;
        if leap(q) {
            p = (p + 1) % 7;
        }
        q += 1;
    }
    println!("{}", q);
}

fn main() {
    run();
}


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

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

fn is_leap(n: usize) -> bool {
    n % 400 == 0 || (n % 4 == 0 && n % 100 != 0)
}

fn solve() {
    let n = parse_line!(usize);
    let mut result = n;
    let mut shift = 0;
    loop {
        if is_leap(result) {
            shift = (shift + 366) % 7;
        }else{
            shift = (shift + 365) % 7;
        }
        result += 1;
        if shift == 0 && is_leap(n) == is_leap(result) {
            break;
        }
    }
    println!("{}", result)
}

fn main() {
    let tests = 1; // parse_line!(usize);
    for _ in 0..tests {
        solve();
    }
}


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

fn main() {
    print!("{}", read_str().replace("WUB", " ").trim().replace("  ", " ").replace("  ", " "));
}


use std::io;

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

    let mut ret = String::new();
    for i in 0..buf.len() {
        if ret.ends_with("WUB") {
            let len = ret.len();
//            ret.replace_range((len - 3)..len, "");
            ret = ret[..len - 3].to_string();
            if ret.ends_with(" ") == false {
                if ret.len() > 0 {
                    ret.push(' ');
                }
            }
        }
        ret.push_str(&buf[i..i + 1]);
    }
    println!("{}", ret.trim());
}


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

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let s = scan!(String);
    s.split("WUB").filter(|x| x.len() != 0).for_each(|x| print!("{} ", x));
}


//! http://codeforces.com/contest/208/problem/A

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

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

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

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

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

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

fn main() {
  scanln!(wubs: String);
  let words = wubs.split("WUB");
  let mut result: Vec<String> = Vec::new();
  for word in words {
    if !word.is_empty() { result.push(word.into()); }
  }
  for (i, word) in result.into_iter().enumerate() {
    if i != 0 { print!(" "); }
    print!("{}", word);
  }
  println!("");
}


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

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

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

	let s = scan.next::<String>();
    let sw = s.replace("WUB", " ");
    let words = sw.split_whitespace().map(String::from).collect::<Vec<String>>();

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


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

fn main() {
    print!("{}", read_str().replace("WUB", " "));
}


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

    let word = word.trim();
    let len = word.len();
    let mut i: usize = 0;

    while i < len {
        if i as i32 <= len as i32 - 3 &&
            word.as_bytes()[i] == b'W' &&
            word.as_bytes()[i + 1] == b'U' &&
            word.as_bytes()[i + 2] == b'B' {
                print!(" ");
                i += 3; continue;
            }

        print!("{}", word.as_bytes()[i] as char);
        i += 1;
    }
}


//spnauti-rust
struct WordReader {
    it : std::vec::IntoIter<String>,
}
#[allow(dead_code)]
impl WordReader {
    fn new<T : std::io::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();
    input.s().replace("WUB", " ").split_whitespace().map(|x| print!("{} ", x)).count();
}


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

fn main() {
    let mut counter = 0;
    let mut col_checked = false;

    for i in 0..8 {
        let mut input_text = String::new();
        io::stdin()
            .read_line(&mut input_text)
            .expect("failed to read from stdin");

        let trimmed = input_text.trim();
        if (trimmed.eq("BBBBBBBB")) {
            counter = counter + 1;
            continue;
        }

        if (col_checked) {
            continue;
        }

        col_checked = true;
        for j in 0..8 {
            let char_at = trimmed.as_bytes()[j];
            if ((char_at as char) == 'B') {
                counter = counter + 1;
            }
        }
    }

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


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

const W: char = 'W';
const B: char = 'B';

fn parse_problem<B: BufRead>(input: B) -> io::Result<[[u8; 8]; 8]> {
    let mut matrix = [[0; 8]; 8];
    for (i, maybe_line) in input.lines().enumerate().take(8) {
        let line = maybe_line?;
        for (j, c) in line.chars().enumerate().take(8) {
            match c {
                B => matrix[i][j] = 1,
                W => {},
                _ => return Err(io::Error::new(io::ErrorKind::InvalidInput,
                                               "not a B or W")),
            }
        }
    }
    Ok(matrix)
}

fn main() -> io::Result<()> {
    let board = parse_problem(io::stdin().lock())?;
    let mut r: u32 = 0;
    let mut c: u32 = 0;
    'outer_row: for i in 0..8 {
        for j in 0..8 {
            if board[i][j] == 0 {
                continue 'outer_row;
            }
        }
        r += 1;
    }
    'outer_col: for j in 0..8 {
        for i in 0..8 {
            if board[i][j] == 0 {
                continue 'outer_col;
            }
        }
        c += 1;
    }
    let result = if r < 8 && c < 8 { r + c } else { 8 };
    println!("{}", result);
    Ok(())
}


macro_rules! scanln {
    () => ({
        let mut buffer = String::new();
        ::std::io::stdin().read_line(&mut buffer).expect("Unable to read line");
        buffer
    });
    ($($t: ty),+) => ({
        scanln!($($t),+, |c: char| c.is_whitespace())
    });
    ($($t: ty),+, $sp: expr) => ({
        let mut buffer = scanln!();
        let mut iter = buffer.split($sp);
        ($(iter.next().unwrap().parse::<$t>().expect("Unable to parse token")),+)
    });
}

fn main() {
    let mut board = Vec::new();
    let mut count = 0;
    let mut checked = false;
    for _ in 0..8 {
        let line = scanln!(String);
        let row: Vec<char> = line.split(' ').flat_map(|s| s.chars()).collect();
        board.push(row);
    }
    for r in board {
        let blacks = r.iter().filter(|c| **c == 'B').count();
        count += if blacks == 8 {
            1
        } else if blacks > 0 && !checked {
            checked = true;
            blacks
        } else {
            0
        }
    }
    println!("{}", count);
}


use std::io::stdin;

fn read_n() -> (u64, u64) {
    let mut buffer = String::new();
    stdin().read_line(&mut buffer).unwrap();
    let snums: Vec<&str> = buffer.trim().split(" ").collect();
    (snums[0].parse::<u64>().unwrap(), snums[1].parse::<u64>().unwrap())
}

fn div2(x: u64) -> u64{
    if x % 2 == 0 {
        return x / 2;
    } else {
        return x / 2 + 1;
    }
}

fn get_n(n: u64, k: u64) -> u64 {
    if k == n && n % 2 == 0 {
        return n;
    }
    if k <= div2(n) {
        return k * 2 - 1;
    } else {
        return k % div2(n) * 2;
    }
}

fn testme() {
    for x in 1..11 {
        print!("{} ", get_n(10, x));
    }
    println!("Test#1 has been done");

    for x in 1..12 {
        print!("{} ", get_n(11, x));
    }
    println!("Test#2 has been done");
}

fn main() {
    let (n, k) = read_n();
    println!("{}", get_n(n, k));
    //testme();
}


// {{{ by shik

use std::io;

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

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

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

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

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

// }}}

fn main() {
    let (n, k) = R!(u64, u64);
    let ans = if k > (n+1)/2 { // even
        (k - (n+1)/2) * 2
    } else { // odd
        k*2 - 1
    };
    println!("{}", ans);
}


//! http://codeforces.com/contest/318/problem/A

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

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

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

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

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

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

fn main() {
  scanln!(n: u64, k: u64);
  let half = n - (n / 2);
  if k <= half {
    println!("{}", k * 2 - 1);
  } else {
    println!("{}", (k - half) * 2);
  }
}


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

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

fn main() -> io::Result<()> {
    let mut input = get_input().trim().to_string();

    let mut substr_iter = input.split_whitespace();

    let mut next_num = || -> i64 {
        substr_iter
            .next()
            .expect("Not enough input numbers")
            .parse()
            .expect("Input is not a number")
    };

    let n = next_num();
    let k = next_num();

    if n % 2 == 0 {
        if k <= n / 2 {
            println!("{}", k * 2 - 1);
        } else {
            println!("{}", (k - n / 2) * 2);
        }
    } else {
        if k <= (n / 2 + 1) {
            println!("{}", k * 2 - 1);
        } else {
            println!("{}", (k - n / 2 - 1) * 2);
        }
    }

    Ok(())
}


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

///////////////////////////////////////////////////////////////////////////////
fn main()
{
    let (n, k) = scan!(i64, i64);
    println!("{}", if 2 * k - 1 > n { 2 * (k - ((n + 1) / 2)) } else { k * 2 - 1 } );
}


fn main() {
    let vec: Vec<u64> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let n = vec[0];
    let index = vec[1];

    let r = {
        if n % 2 == 0 {
            0
        } else {
            1
        }
    };

    if n / 2 + r >= index {
        // ODD NUMBER
        let res = index * 2 - 1;
        println!("{}", res);
    } else {
        // EVEN NUMBER
        let res = (index - n / 2) * 2;
        let res = {
            if n % 2 == 0 {
                res
            } else {
                res - 2
            }
        };
        println!("{}", res);
    }
}

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

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}


fn readln() -> Vec<i64> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect()
}

fn main() {
    let input = readln();
    let n = input[0];
    let k = input[1];

    println!("{}", if k <= (n + 1) / 2 {k * 2 - 1} else {(k - (n + 1) / 2) * 2});
}


use std::str::FromStr;

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

fn read_vec<T: FromStr>(split_char: char) -> Vec<T> {
    read_str()
        .split(split_char)
        .map(|value| value.parse::<T>().ok().expect("Error"))
        .collect()
}

fn read_tuple<T: FromStr + Copy>() -> (T, T) {
    let buffer: Vec<T> = read_vec(' ');
    (buffer[0], buffer[1])
}

trait Utils { fn div_ceil(self, divisor: Self) -> Self; }
macro_rules! impl_div { ($($t:ty)+) => { $(
    impl Utils for $t {
        fn div_ceil(self, divisor: Self) -> Self {
            (self + divisor - 1) / divisor
        }
    }
)*}}
impl_div!{u32 u64}

fn main() {
    let (k, n): (u64, u64) = read_tuple();
    let mid: u64 = k.div_ceil(2);

    if n > mid { println!("{}", 2 * (n - mid)); }
    else { println!("{}", (2 * n) - 1); }
}


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

fn sequence_position(level: u32, idx: u64) -> u32 {
    match level {
        1 => 1,
        _ => {
            let half_length = 2_u64.pow(level - 1);
            match idx.cmp(&half_length) {
                Ordering::Less => sequence_position(level - 1, idx),
                Ordering::Equal => level,
                Ordering::Greater => sequence_position(level - 1, idx - half_length)
            }
        }
    }
}

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

    let mut iter = input_str.trim().split_whitespace();
    let level: u32 = iter.next().unwrap().parse().unwrap();
    let position: u64 = iter.next().unwrap().parse().unwrap();

    println!("{}", sequence_position(level, position));
}


#![allow(unused_imports)]
use std::io;
use std::io::prelude::*;
use std::io::BufReader;
use std::str::FromStr;
use std::collections::{VecDeque, HashMap};

fn main() {
    let stdin = io::stdin();
    let mut input = stdin.lock();
    let mut line = String::new();
    input.read_line(&mut line).unwrap();
    let nums = get_numbers::<u64>(&line);
    let n = nums[0];
    let k = nums[1] - 1; // k is numbered from 1

    let length = u64::pow(2, n as u32) - 1;

    let mut val = n;
    let mut ind = length / 2;
    let mut lower = 0;
    let mut upper = length;

    while ind != k {
        val = val - 1;
        if ind > k {
            upper = ind;
            ind = (lower + upper) / 2;
        } else {
            lower = ind;
            ind = (lower + upper) / 2;
        }
    }

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

/*
 * Utility Functions
 */

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


use std::io::stdin;

fn get_input(input: &mut String) {
    input.clear();
    stdin().read_line(input).expect("error");
}

fn main() {
    let mut input = String::new();
    get_input(&mut input);
    let mut numbers = input.trim().split_whitespace().filter_map(|n| n.parse::<u64>().ok());
    let n = numbers.next().unwrap();
    let k = numbers.next().unwrap();

    let mut local_n = 1u64;
    let mut local_k = k;
    while local_k % 2 != 1 {
        local_k >>= 1;
        local_n += 1;
    }

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


use std::io;

type Matrix = Vec<Vec<char>>;

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

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

fn read_line_pair() -> (u64, u64) {
    let vec = read_line_vec();
    return (vec[0], vec[1]);
}

fn main() {
    let (_n, mut k) = read_line_pair();

    let mut res = 1u32;
    while k & 1 == 0 {
        res += 1;
        k /= 2;
    }

    println!("{}", res);

}