You won't find this sequence on OEIS.

#![allow(dead_code)]

use std::str::FromStr;

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

fn read_val<T: FromStr>() -> T {
    read_line().parse::<T>().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    read_line().split_whitespace().map(|x| x.parse::<T>().ok().unwrap()).collect()
}

fn read_arr<T: FromStr, const N: usize>() -> [T; N] {
    read_vec().try_into().ok().unwrap()
}

fn bound<T: Copy + PartialOrd>(vec: &[T], value: T, f: fn(T, T) -> bool) -> Option<(usize, T)> {
    let mut left = 0usize;
    let mut right = vec.len();

    while left < right {
        let mid = (right + left) / 2;
        if f(value, vec[mid]) {
            right = mid
        } else {
            left = mid + 1
        }
    }
    if left < vec.len() { Some((left, vec[left])) } else { None }
}

fn main() {
    let r: i32 = read_val();
    let a = [1200, 1400, 1600, 1900, 2100, 2300, 2400, 2600, 3000];

    println!("{}", bound(&a, r, |x, y| x < y).unwrap().1);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

macro_rules! impl_common_num_ext {
    ($($ix:tt = $ux:tt),*) => {
        $(
            impl CommonNumExt for $ux {
                fn div_ceil(self, b: Self) -> Self {
                    let q = self / b; let r = self % b;
                    if r != 0 { q + 1 } else { q }
                }
                fn div_floor(self, b: Self) -> Self { self / b }
                fn gcd(self, mut b: Self) -> Self {
                    let mut a = self;
                    if a == 0 || b == 0 { return a | b; }
                    let shift = (a | b).trailing_zeros();
                    a >>= a.trailing_zeros();
                    b >>= b.trailing_zeros();
                    while a != b {
                        if a > b { a -= b; a >>= a.trailing_zeros(); }
                        else { b -= a; b >>= b.trailing_zeros(); }
                    }
                    a << shift
                }
                #[inline] fn highest_one(self) -> Self {
                    if self == 0 { 0 } else { const ONE: $ux = 1; ONE << self.sig_bits() - 1 }
                }
                #[inline] fn lowest_one(self) -> Self { self & self.wrapping_neg() }
                #[inline] fn sig_bits(self) -> u32 { std::mem::size_of::<$ux>() as u32 * 8 - self.leading_zeros() }
            }

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

trait ChMaxMin<T> {
    fn chmax(&mut self, v: T) -> bool;
    fn chmin(&mut self, v: T) -> bool;
}
impl<T: PartialOrd> ChMaxMin<T> for Option<T> {
    fn chmax(&mut self, v: T) -> bool { if self.is_none() || v > *self.as_ref().unwrap() { *self = Some(v); true } else { false } }
    fn chmin(&mut self, v: T) -> bool { if self.is_none() || v < *self.as_ref().unwrap() { *self = Some(v); true } else { false } }
}
impl<T: PartialOrd> ChMaxMin<T> for T {
    fn chmax(&mut self, v: T) -> bool { if v > *self { *self = v; true } else { false } }
    fn chmin(&mut self, v: T) -> bool { if v < *self { *self = v; true } else { false } }
}

// * end commons * //

#[derive(Clone, Debug)]
pub struct Arr2<T> {
    a: usize, b: usize, t: Vec<T>
}
impl <T: Default + Clone> Arr2<T> {
    pub fn new(a: usize, b: usize) -> Self {
        Self { a, b, t: vec![T::default(); a*b] }
    }
}
impl <T: Clone> Arr2<T> {
    pub fn filled(a: usize, b: usize, v: T) -> Self {
        Self { a, b, t: vec![v; a*b] }
    }
}
impl <T> Arr2<T> {
    pub fn idx(&self, i: usize, j: usize) -> usize {
        debug_assert!(i < self.a && j < self.b);
        i.mul(self.b).add(j)
    }

    pub fn shape(&self) -> [usize; 2] { [self.a, self.b] }
}

impl <T> Index<[usize; 2]> for Arr2<T> {
    type Output = T;

    fn index(&self, [i, j]: [usize; 2]) -> &Self::Output {
        &self.t[self.idx(i, j)]
    }
}

impl <T> IndexMut<[usize; 2]> for Arr2<T> {
    fn index_mut(&mut self, [i, j]: [usize; 2]) -> &mut Self::Output {
        let i = self.idx(i, j);
        &mut self.t[i]
    }
}

impl <T> Index<usize> for Arr2<T> {
    type Output = [T];

    fn index(&self, i: usize) -> &Self::Output {
        &self.t[i * self.b .. (i+1) * self.b]
    }
}

impl <T> IndexMut<usize> for Arr2<T> {
    fn index_mut(&mut self, i: usize) -> &mut Self::Output {
        &mut self.t[i * self.b .. (i+1) * self.b]
    }
}

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

    for _case_num in 1..=num_cases {
        let S = [1200,1400,1600,1900,2100,2300,2400,2600,3000];
        let r = read!(i32);

        let ans = *S.iter().find(|&&s| s > r).unwrap();
        println!(ans);
    }

    out_flush();
}

// use wyf_lib::*;

fn calc(x: i64) -> i64 {
    if x < 1200 {
        1200
    } else if x < 1400 {
        1400
    } else if x < 1600 {
        1600
    } else if x < 1900 {
        1900
    } else if x < 2100 {
        2100
    } else if x < 2300 {
        2300
    } else if x < 2400 {
        2400
    } else if x < 2600 {
        2600
    } else {
        3000
    }
}

fn main() {
    let x: i64 = read();
    // (x + 1).println();
    calc(x).println();
}

use std::error;
use std::fmt;
use std::str::FromStr;

#[non_exhaustive]
#[derive(Debug, PartialEq)]
pub enum Error {
    MissingMatch,
    MissingClosingBrace,
    UnexpectedValue(u8, Option<u8>),
    InvalidUtf8(Vec<u8>),
    PartialUtf8(usize, Vec<u8>),
    Parse(String, &'static str),
}

impl error::Error for Error {}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        use crate::Error::*;
        use std::str::from_utf8;

        match *self {
            InvalidUtf8(ref raw) => write!(f, "input was not valid utf8: {:?}", raw),
            Parse(ref s, arg) => write!(f, "could not parse {} as target type of {}", s, arg),
            UnexpectedValue(exp, act) => write!(
                f,
                "found value {:?} not matching the pattern value {}",
                act.map(|b| b as char),
                exp as char
            ),
            PartialUtf8(n, ref raw) => write!(
                f,
                "input was only partially valid utf8: \"{}\" followed by {:?}",
                from_utf8(&raw[..n]).unwrap(),
                &raw[n..]
            ),
            MissingMatch => write!(f, "Bad read! format string: did not contain {{}}"),
            MissingClosingBrace => write!(
                f,
                "found single open curly brace at the end of the format string"
            ),
        }
    }
}

pub fn match_next(expected: u8, iter: &mut dyn Iterator<Item = u8>) -> Result<(), Error> {
    let next = iter.next();
    if next != Some(expected) {
        return Err(Error::UnexpectedValue(expected, next));
    }
    Ok(())
}

pub fn parse_capture<T>(
    name: &'static str,
    next: Option<u8>,
    iter: &mut dyn Iterator<Item = u8>,
) -> Result<T, Error>
where
    T: FromStr,
    <T as FromStr>::Err: ::std::fmt::Debug,
{
    static WHITESPACES: &[u8] = b"\t\r\n ";
    let raw: Vec<u8> = match next {
        Some(c) => iter.take_while(|&ch| ch != c).collect(),
        None => iter
            .skip_while(|ch| WHITESPACES.contains(ch))
            .take_while(|ch| !WHITESPACES.contains(ch))
            .collect(),
    };
    match String::from_utf8(raw) {
        Ok(s) => FromStr::from_str(&s).map_err(|_| Error::Parse(s, name)),
        Err(e) => {
            let n = e.utf8_error().valid_up_to();
            let raw = e.into_bytes();
            if n == 0 {
                Err(Error::InvalidUtf8(raw))
            } else {
                Err(Error::PartialUtf8(n, raw))
            }
        }
    }
}

#[macro_export]
macro_rules! try_read(
    () => { $crate::try_read!("{}") };
    ($text:expr) => {{
        (|| -> std::result::Result<_, $crate::Error> {
            let __try_read_var__;
            $crate::try_scan!($text, __try_read_var__);
            Ok(__try_read_var__)
        })()
    }};
    ($text:expr, $input:expr) => {{
        (|| -> std::result::Result<_, $crate::Error> {
            let __try_read_var__;
            $crate::try_scan!($input => $text, __try_read_var__);
            Ok(__try_read_var__)
        })()
    }};
);

#[macro_export]
macro_rules! try_scan(
    ($pattern:expr, $($arg:expr),*) => {
        use ::std::io::Read;
        $crate::try_scan!(::std::io::stdin().bytes().map(std::result::Result::unwrap) => $pattern, $($arg),*);
    };
    ($input:expr => $pattern:expr, $($arg:expr),*) => {{
        $crate::try_scan!(@impl question_mark; $input => $pattern, $($arg),*)
    }};
    (@question_mark: $($e:tt)+) => {{
        ($($e)+)?
    }};
    (@unwrap: $($e:tt)+) => {{
        ($($e)+).unwrap()
    }};
    (@impl $action:tt; $input:expr => $pattern:expr, $($arg:expr),*) => {{
        #![allow(clippy::try_err)]
        use $crate::{Error, match_next, parse_capture};

        // typesafe macros :)
        let pattern: &'static str = $pattern;
        let stdin: &mut dyn Iterator<Item = u8> = &mut ($input);

        let mut pattern = pattern.bytes();

        $(
            $arg = loop {
                match $crate::try_scan!(@$action: pattern.next().ok_or(Error::MissingMatch)) {
                    b'{' => match $crate::try_scan!(@$action: pattern.next().ok_or(Error::MissingClosingBrace)) {
                        b'{' => $crate::try_scan!(@$action: match_next(b'{', stdin)),
                        b'}' => break $crate::try_scan!(@$action: parse_capture(stringify!($arg), pattern.next(), stdin)),
                        _ => return $crate::try_scan!(@$action: Err(Error::MissingClosingBrace)),
                    },
                    c => $crate::try_scan!(@$action: match_next(c, stdin)),
                }
            };
        )*

        for c in pattern {
            $crate::try_scan!(@$action: match_next(c, stdin))
        }

        format_args!($pattern, $($arg),*);
    }};
);

#[macro_export]
macro_rules! read(
    ($($arg:tt)*) => {
        $crate::try_read!($($arg)*).unwrap()
    };
);

#[macro_export]
macro_rules! scan(
    ($text:expr, $($arg:expr),*) => {
        {
            use ::std::io::Read;
            $crate::scan!(::std::io::stdin().bytes().map(std::result::Result::unwrap) => $text, $($arg),*);
        }
    };
    ($input:expr => $pattern:expr, $($arg:expr),*) => {{
        $crate::try_scan!(@impl unwrap; $input => $pattern, $($arg),*)
    }};
);
use std::marker::PhantomData;
use std::ops;

// use text_io::read;

/*** READ and WRITE ***/

pub trait Readable {
    fn read() -> Self;
}

pub trait Printable {
    fn print(self: &Self);
    fn println(self: &Self) {
        self.print();
        println!();
    }
}

macro_rules! impl_rp_simple {
    ($($t:ident), +) => {
        $(
            impl Readable for $t {
                fn read() -> Self {
                    read!()
                }
            }

            impl Printable for $t {
                fn print(self: &Self) {
                    print!("{self} ");
                }
            }
        )+
    };
}

impl_rp_simple!(
    String, i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize, f32, f64, char
);

macro_rules! impl_rp_tuple {
    () => {};
    ($t0:ident, $($t:ident,) *) => {
        impl<$t0: Readable, $($t: Readable), *> Readable for ($t0, $($t,)*) {
            fn read() -> Self {
                (read(), $(read::<$t>(),)*)
            }
        }

        impl<$t0: Printable, $($t: Printable), *> Printable for ($t0, $($t,)*) {
            fn print(self: &Self) {
                #[allow(non_snake_case)]
                let (ref $t0, $(ref $t,)*) = &self;
                $t0.print();
                $(
                    $t.print();
                )*
            }
        }

        impl_rp_tuple!{$($t,) *}
    };
}

impl<T: Printable> Printable for Vec<T> {
    fn print(self: &Self) {
        for x in self {
            x.print();
        }
    }
}

impl<T: Printable> Printable for [T] {
    fn print(self: &Self) {
        for x in self {
            x.print();
        }
    }
}

impl_rp_tuple! {T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,}

pub fn read<T: Readable>() -> T {
    T::read()
}

pub fn readv<T: Readable>(size: usize) -> Vec<T> {
    let mut res = Vec::with_capacity(size);
    for _ in 0..size {
        res.push(read());
    }
    res
}

pub fn readb() -> Vec<u8> {
    let s: String = read!();
    s.as_bytes().into_iter().cloned().collect()
}

/*** RECURSIVE LAMBDA ***/

macro_rules! recursive_fn {
    () => {};
    ($name0:ident $trait0:ident $_:ident $__:ident, $($name:ident $trait:ident $Arg:ident $arg:ident,)*) => {
        pub trait $trait0<$($Arg,)* Output> {
            fn call(&mut self, $($arg: $Arg,)*) -> Output;
        }

        pub struct $name0<F, $($Arg,)* Output>
        where
            F: FnMut(&mut dyn $trait0<$($Arg,)* Output>, $($Arg,)*) -> Output,
        {
            f: std::cell::UnsafeCell<F>,
            $(
                $arg: PhantomData<$Arg>,
            )*
            phantom_output: PhantomData<Output>,
        }

        impl<F, $($Arg,)* Output> $name0<F, $($Arg,)* Output>
        where
            F: FnMut(&mut dyn $trait0<$($Arg,)* Output>, $($Arg,)*) -> Output,
        {
            pub fn new(f: F) -> Self {
                Self {
                    f: std::cell::UnsafeCell::new(f),
                    $(
                        $arg: PhantomData,
                    )*
                    phantom_output: PhantomData,
                }
            }
        }

        impl<F, $($Arg,)* Output> $trait0<$($Arg,)* Output> for $name0<F, $($Arg,)* Output>
        where
            F: FnMut(&mut dyn $trait0<$($Arg,)* Output>, $($Arg,)*) -> Output,
        {
            fn call(&mut self, $($arg: $Arg,)*) -> Output {
                unsafe { (&mut *self.f.get())(self, $($arg,)*) }
            }
        }

        recursive_fn!{$($name $trait $Arg $arg,)*}
    };
}

recursive_fn! {
    RecursiveFn11 Callable11 Arg11 arg11,
    RecursiveFn10 Callable10 Arg10 arg10,
    RecursiveFn9 Callable9 Arg9 arg9,
    RecursiveFn8 Callable8 Arg8 arg8,
    RecursiveFn7 Callable7 Arg7 arg7,
    RecursiveFn6 Callable6 Arg6 arg6,
    RecursiveFn5 Callable5 Arg5 arg5,
    RecursiveFn4 Callable4 Arg4 arg4,
    RecursiveFn3 Callable3 Arg3 arg3,
    RecursiveFn2 Callable2 Arg2 arg2,
    RecursiveFn1 Callable1 Arg1 arg1,
    RecursiveFn0 Callable0 Arg0 arg0,
}

/*** MOD ***/

// gcd, x, y
pub fn extended_gcd(a: i64, b: i64) -> (i64, i64, i64) {
    if a == 0 {
        (b, 0, 1)
    } else {
        let (g, y, mut x) = extended_gcd(b % a, a);
        x -= (b / a) * y;
        (g, x, y)
    }
}

pub trait HasConstVal {
    const VAL: i64;
}

// const of V has to be prime
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ModBase<M: HasConstVal + Copy> {
    v: i64,
    phantom: PhantomData<M>,
}

impl<M: HasConstVal + Copy> ModBase<M> {
    pub fn new(mut v: i64) -> Self {
        v %= M::VAL;
        if v < 0 {
            v = v + M::VAL;
        }
        Self {
            v,
            phantom: PhantomData,
        }
    }

    pub fn inv(&self) -> Self {
        let (_, x, _) = extended_gcd(self.v, M::VAL);
        Self::new(x)
    }

    pub fn pow(&self, n: usize) -> Self {
        let v = self.v;
        let mut res = Self::new(1);
        for _ in 0..n {
            res *= v;
        }
        res
    }
}

impl<M: HasConstVal + Copy> ops::Add<i64> for ModBase<M> {
    type Output = Self;

    fn add(self, rhs: i64) -> Self {
        Self::new(self.v + rhs)
    }
}

impl<M: HasConstVal + Copy> ops::Add for ModBase<M> {
    type Output = Self;

    fn add(self, rhs: Self) -> Self {
        Self::new(self.v + rhs.v)
    }
}

impl<M: HasConstVal + Copy> ops::AddAssign<i64> for ModBase<M> {
    fn add_assign(&mut self, rhs: i64) {
        self.v = (self.v + rhs) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::AddAssign for ModBase<M> {
    fn add_assign(&mut self, rhs: Self) {
        self.v = (self.v + rhs.v) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::Sub<i64> for ModBase<M> {
    type Output = Self;

    fn sub(self, rhs: i64) -> Self {
        Self::new(self.v - rhs)
    }
}

impl<M: HasConstVal + Copy> ops::Sub for ModBase<M> {
    type Output = Self;

    fn sub(self, rhs: Self) -> Self {
        Self::new(self.v - rhs.v)
    }
}

impl<M: HasConstVal + Copy> ops::SubAssign<i64> for ModBase<M> {
    fn sub_assign(&mut self, rhs: i64) {
        self.v = (self.v - rhs) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::SubAssign for ModBase<M> {
    fn sub_assign(&mut self, rhs: Self) {
        self.v = (self.v - rhs.v) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::Mul<i64> for ModBase<M> {
    type Output = Self;

    fn mul(self, rhs: i64) -> Self::Output {
        Self::new(self.v * rhs)
    }
}

impl<M: HasConstVal + Copy> ops::Mul for ModBase<M> {
    type Output = Self;

    fn mul(self, rhs: Self) -> Self::Output {
        Self::new(self.v * rhs.v)
    }
}

impl<M: HasConstVal + Copy> ops::MulAssign<i64> for ModBase<M> {
    fn mul_assign(&mut self, rhs: i64) {
        self.v = self.v * rhs % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::MulAssign for ModBase<M> {
    fn mul_assign(&mut self, rhs: Self) {
        self.v = self.v * rhs.v % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::Div<i64> for ModBase<M> {
    type Output = Self;

    fn div(self, rhs: i64) -> Self::Output {
        self * Self::new(rhs).inv()
    }
}

impl<M: HasConstVal + Copy> ops::Div for ModBase<M> {
    type Output = Self;

    fn div(self, rhs: Self) -> Self::Output {
        self * rhs.inv()
    }
}

impl<M: HasConstVal + Copy> ops::DivAssign<i64> for ModBase<M> {
    fn div_assign(&mut self, rhs: i64) {
        self.v = (Self::new(self.v) / rhs).v;
    }
}

impl<M: HasConstVal + Copy> ops::DivAssign for ModBase<M> {
    fn div_assign(&mut self, rhs: Self) {
        self.v = (Self::new(self.v) / rhs).v;
    }
}

impl<M: HasConstVal + Copy> ops::Neg for ModBase<M> {
    type Output = Self;

    fn neg(self) -> Self::Output {
        Self::new(-self.v)
    }
}

impl<M: HasConstVal + Copy> ops::Deref for ModBase<M> {
    type Target = i64;

    fn deref(&self) -> &Self::Target {
        &self.v
    }
}

#[macro_export]
macro_rules! Mod {
    ($val: expr) => {
        Mod!(Mod, ModV, $val);
    };
    ($name: ident, $v_name: ident, $val: expr) => {
        #[derive(Copy, Clone, Eq, PartialEq)]
        pub struct $v_name {}

        impl crate::HasConstVal for $v_name {
            const VAL: i64 = $val as i64;
        }

        type $name = ModBase<$v_name>;
    };
}

#![allow(dead_code)]

use std::str::FromStr;

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

fn read_val<T: FromStr>() -> T {
    read_line().parse::<T>().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    read_line().split_whitespace().map(|x| x.parse::<T>().ok().unwrap()).collect()
}

fn read_arr<T: FromStr, const N: usize>() -> [T; N] {
    read_vec().try_into().ok().unwrap()
}

fn bound<T: Copy + PartialOrd>(vec: &[T], value: T, f: fn(T, T) -> bool) -> Option<(usize, T)> {
    let mut left = 0usize;
    let mut right = vec.len();

    while left < right {
        let mid = (right + left) / 2;
        if f(value, vec[mid]) {
            right = mid
        } else {
            left = mid + 1
        }
    }
    if left < vec.len() { Some((left, vec[left])) } else { None }
}

fn main() {
    let r: i32 = read_val();
    let a = [1200, 1400, 1600, 1900, 2100, 2300, 2400, 2600, 3000];

    println!("{}", bound(&a, r, |x, y| x <= y).unwrap().1);
}

#![allow(dead_code)]

use std::str::FromStr;

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

fn read_val<T: FromStr>() -> T {
    read_line().parse::<T>().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    read_line().split_whitespace().map(|x| x.parse::<T>().ok().unwrap()).collect()
}

fn read_arr<T: FromStr, const N: usize>() -> [T; N] {
    read_vec().try_into().ok().unwrap()
}

fn main() {
   let n: i32 = read_val();
    println!("{}", n+1)
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

macro_rules! impl_common_num_ext {
    ($($ix:tt = $ux:tt),*) => {
        $(
            impl CommonNumExt for $ux {
                fn div_ceil(self, b: Self) -> Self {
                    let q = self / b; let r = self % b;
                    if r != 0 { q + 1 } else { q }
                }
                fn div_floor(self, b: Self) -> Self { self / b }
                fn gcd(self, mut b: Self) -> Self {
                    let mut a = self;
                    if a == 0 || b == 0 { return a | b; }
                    let shift = (a | b).trailing_zeros();
                    a >>= a.trailing_zeros();
                    b >>= b.trailing_zeros();
                    while a != b {
                        if a > b { a -= b; a >>= a.trailing_zeros(); }
                        else { b -= a; b >>= b.trailing_zeros(); }
                    }
                    a << shift
                }
                #[inline] fn highest_one(self) -> Self {
                    if self == 0 { 0 } else { const ONE: $ux = 1; ONE << self.sig_bits() - 1 }
                }
                #[inline] fn lowest_one(self) -> Self { self & self.wrapping_neg() }
                #[inline] fn sig_bits(self) -> u32 { std::mem::size_of::<$ux>() as u32 * 8 - self.leading_zeros() }
            }

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

trait ChMaxMin<T> {
    fn chmax(&mut self, v: T) -> bool;
    fn chmin(&mut self, v: T) -> bool;
}
impl<T: PartialOrd> ChMaxMin<T> for Option<T> {
    fn chmax(&mut self, v: T) -> bool { if self.is_none() || v > *self.as_ref().unwrap() { *self = Some(v); true } else { false } }
    fn chmin(&mut self, v: T) -> bool { if self.is_none() || v < *self.as_ref().unwrap() { *self = Some(v); true } else { false } }
}
impl<T: PartialOrd> ChMaxMin<T> for T {
    fn chmax(&mut self, v: T) -> bool { if v > *self { *self = v; true } else { false } }
    fn chmin(&mut self, v: T) -> bool { if v < *self { *self = v; true } else { false } }
}

// * end commons * //

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

    for _case_num in 1..=num_cases {
        let x = read!(i32);
        println!(x+1);
    }

    out_flush();
}

// use wyf_lib::*;

fn main() {
    let x: i64 = read();
    (x + 1).println();
}

use std::error;
use std::fmt;
use std::str::FromStr;

#[non_exhaustive]
#[derive(Debug, PartialEq)]
pub enum Error {
    MissingMatch,
    MissingClosingBrace,
    UnexpectedValue(u8, Option<u8>),
    InvalidUtf8(Vec<u8>),
    PartialUtf8(usize, Vec<u8>),
    Parse(String, &'static str),
}

impl error::Error for Error {}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        use crate::Error::*;
        use std::str::from_utf8;

        match *self {
            InvalidUtf8(ref raw) => write!(f, "input was not valid utf8: {:?}", raw),
            Parse(ref s, arg) => write!(f, "could not parse {} as target type of {}", s, arg),
            UnexpectedValue(exp, act) => write!(
                f,
                "found value {:?} not matching the pattern value {}",
                act.map(|b| b as char),
                exp as char
            ),
            PartialUtf8(n, ref raw) => write!(
                f,
                "input was only partially valid utf8: \"{}\" followed by {:?}",
                from_utf8(&raw[..n]).unwrap(),
                &raw[n..]
            ),
            MissingMatch => write!(f, "Bad read! format string: did not contain {{}}"),
            MissingClosingBrace => write!(
                f,
                "found single open curly brace at the end of the format string"
            ),
        }
    }
}

pub fn match_next(expected: u8, iter: &mut dyn Iterator<Item = u8>) -> Result<(), Error> {
    let next = iter.next();
    if next != Some(expected) {
        return Err(Error::UnexpectedValue(expected, next));
    }
    Ok(())
}

pub fn parse_capture<T>(
    name: &'static str,
    next: Option<u8>,
    iter: &mut dyn Iterator<Item = u8>,
) -> Result<T, Error>
where
    T: FromStr,
    <T as FromStr>::Err: ::std::fmt::Debug,
{
    static WHITESPACES: &[u8] = b"\t\r\n ";
    let raw: Vec<u8> = match next {
        Some(c) => iter.take_while(|&ch| ch != c).collect(),
        None => iter
            .skip_while(|ch| WHITESPACES.contains(ch))
            .take_while(|ch| !WHITESPACES.contains(ch))
            .collect(),
    };
    match String::from_utf8(raw) {
        Ok(s) => FromStr::from_str(&s).map_err(|_| Error::Parse(s, name)),
        Err(e) => {
            let n = e.utf8_error().valid_up_to();
            let raw = e.into_bytes();
            if n == 0 {
                Err(Error::InvalidUtf8(raw))
            } else {
                Err(Error::PartialUtf8(n, raw))
            }
        }
    }
}

#[macro_export]
macro_rules! try_read(
    () => { $crate::try_read!("{}") };
    ($text:expr) => {{
        (|| -> std::result::Result<_, $crate::Error> {
            let __try_read_var__;
            $crate::try_scan!($text, __try_read_var__);
            Ok(__try_read_var__)
        })()
    }};
    ($text:expr, $input:expr) => {{
        (|| -> std::result::Result<_, $crate::Error> {
            let __try_read_var__;
            $crate::try_scan!($input => $text, __try_read_var__);
            Ok(__try_read_var__)
        })()
    }};
);

#[macro_export]
macro_rules! try_scan(
    ($pattern:expr, $($arg:expr),*) => {
        use ::std::io::Read;
        $crate::try_scan!(::std::io::stdin().bytes().map(std::result::Result::unwrap) => $pattern, $($arg),*);
    };
    ($input:expr => $pattern:expr, $($arg:expr),*) => {{
        $crate::try_scan!(@impl question_mark; $input => $pattern, $($arg),*)
    }};
    (@question_mark: $($e:tt)+) => {{
        ($($e)+)?
    }};
    (@unwrap: $($e:tt)+) => {{
        ($($e)+).unwrap()
    }};
    (@impl $action:tt; $input:expr => $pattern:expr, $($arg:expr),*) => {{
        #![allow(clippy::try_err)]
        use $crate::{Error, match_next, parse_capture};

        // typesafe macros :)
        let pattern: &'static str = $pattern;
        let stdin: &mut dyn Iterator<Item = u8> = &mut ($input);

        let mut pattern = pattern.bytes();

        $(
            $arg = loop {
                match $crate::try_scan!(@$action: pattern.next().ok_or(Error::MissingMatch)) {
                    b'{' => match $crate::try_scan!(@$action: pattern.next().ok_or(Error::MissingClosingBrace)) {
                        b'{' => $crate::try_scan!(@$action: match_next(b'{', stdin)),
                        b'}' => break $crate::try_scan!(@$action: parse_capture(stringify!($arg), pattern.next(), stdin)),
                        _ => return $crate::try_scan!(@$action: Err(Error::MissingClosingBrace)),
                    },
                    c => $crate::try_scan!(@$action: match_next(c, stdin)),
                }
            };
        )*

        for c in pattern {
            $crate::try_scan!(@$action: match_next(c, stdin))
        }

        format_args!($pattern, $($arg),*);
    }};
);

#[macro_export]
macro_rules! read(
    ($($arg:tt)*) => {
        $crate::try_read!($($arg)*).unwrap()
    };
);

#[macro_export]
macro_rules! scan(
    ($text:expr, $($arg:expr),*) => {
        {
            use ::std::io::Read;
            $crate::scan!(::std::io::stdin().bytes().map(std::result::Result::unwrap) => $text, $($arg),*);
        }
    };
    ($input:expr => $pattern:expr, $($arg:expr),*) => {{
        $crate::try_scan!(@impl unwrap; $input => $pattern, $($arg),*)
    }};
);
use std::marker::PhantomData;
use std::ops;

// use text_io::read;

/*** READ and WRITE ***/

pub trait Readable {
    fn read() -> Self;
}

pub trait Printable {
    fn print(self: &Self);
    fn println(self: &Self) {
        self.print();
        println!();
    }
}

macro_rules! impl_rp_simple {
    ($($t:ident), +) => {
        $(
            impl Readable for $t {
                fn read() -> Self {
                    read!()
                }
            }

            impl Printable for $t {
                fn print(self: &Self) {
                    print!("{self} ");
                }
            }
        )+
    };
}

impl_rp_simple!(
    String, i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize, f32, f64, char
);

macro_rules! impl_rp_tuple {
    () => {};
    ($t0:ident, $($t:ident,) *) => {
        impl<$t0: Readable, $($t: Readable), *> Readable for ($t0, $($t,)*) {
            fn read() -> Self {
                (read(), $(read::<$t>(),)*)
            }
        }

        impl<$t0: Printable, $($t: Printable), *> Printable for ($t0, $($t,)*) {
            fn print(self: &Self) {
                #[allow(non_snake_case)]
                let (ref $t0, $(ref $t,)*) = &self;
                $t0.print();
                $(
                    $t.print();
                )*
            }
        }

        impl_rp_tuple!{$($t,) *}
    };
}

impl<T: Printable> Printable for Vec<T> {
    fn print(self: &Self) {
        for x in self {
            x.print();
        }
    }
}

impl<T: Printable> Printable for [T] {
    fn print(self: &Self) {
        for x in self {
            x.print();
        }
    }
}

impl_rp_tuple! {T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,}

pub fn read<T: Readable>() -> T {
    T::read()
}

pub fn readv<T: Readable>(size: usize) -> Vec<T> {
    let mut res = Vec::with_capacity(size);
    for _ in 0..size {
        res.push(read());
    }
    res
}

pub fn readb() -> Vec<u8> {
    let s: String = read!();
    s.as_bytes().into_iter().cloned().collect()
}

/*** RECURSIVE LAMBDA ***/

macro_rules! recursive_fn {
    () => {};
    ($name0:ident $trait0:ident $_:ident $__:ident, $($name:ident $trait:ident $Arg:ident $arg:ident,)*) => {
        pub trait $trait0<$($Arg,)* Output> {
            fn call(&mut self, $($arg: $Arg,)*) -> Output;
        }

        pub struct $name0<F, $($Arg,)* Output>
        where
            F: FnMut(&mut dyn $trait0<$($Arg,)* Output>, $($Arg,)*) -> Output,
        {
            f: std::cell::UnsafeCell<F>,
            $(
                $arg: PhantomData<$Arg>,
            )*
            phantom_output: PhantomData<Output>,
        }

        impl<F, $($Arg,)* Output> $name0<F, $($Arg,)* Output>
        where
            F: FnMut(&mut dyn $trait0<$($Arg,)* Output>, $($Arg,)*) -> Output,
        {
            pub fn new(f: F) -> Self {
                Self {
                    f: std::cell::UnsafeCell::new(f),
                    $(
                        $arg: PhantomData,
                    )*
                    phantom_output: PhantomData,
                }
            }
        }

        impl<F, $($Arg,)* Output> $trait0<$($Arg,)* Output> for $name0<F, $($Arg,)* Output>
        where
            F: FnMut(&mut dyn $trait0<$($Arg,)* Output>, $($Arg,)*) -> Output,
        {
            fn call(&mut self, $($arg: $Arg,)*) -> Output {
                unsafe { (&mut *self.f.get())(self, $($arg,)*) }
            }
        }

        recursive_fn!{$($name $trait $Arg $arg,)*}
    };
}

recursive_fn! {
    RecursiveFn11 Callable11 Arg11 arg11,
    RecursiveFn10 Callable10 Arg10 arg10,
    RecursiveFn9 Callable9 Arg9 arg9,
    RecursiveFn8 Callable8 Arg8 arg8,
    RecursiveFn7 Callable7 Arg7 arg7,
    RecursiveFn6 Callable6 Arg6 arg6,
    RecursiveFn5 Callable5 Arg5 arg5,
    RecursiveFn4 Callable4 Arg4 arg4,
    RecursiveFn3 Callable3 Arg3 arg3,
    RecursiveFn2 Callable2 Arg2 arg2,
    RecursiveFn1 Callable1 Arg1 arg1,
    RecursiveFn0 Callable0 Arg0 arg0,
}

/*** MOD ***/

// gcd, x, y
pub fn extended_gcd(a: i64, b: i64) -> (i64, i64, i64) {
    if a == 0 {
        (b, 0, 1)
    } else {
        let (g, y, mut x) = extended_gcd(b % a, a);
        x -= (b / a) * y;
        (g, x, y)
    }
}

pub trait HasConstVal {
    const VAL: i64;
}

// const of V has to be prime
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct ModBase<M: HasConstVal + Copy> {
    v: i64,
    phantom: PhantomData<M>,
}

impl<M: HasConstVal + Copy> ModBase<M> {
    pub fn new(mut v: i64) -> Self {
        v %= M::VAL;
        if v < 0 {
            v = v + M::VAL;
        }
        Self {
            v,
            phantom: PhantomData,
        }
    }

    pub fn inv(&self) -> Self {
        let (_, x, _) = extended_gcd(self.v, M::VAL);
        Self::new(x)
    }

    pub fn pow(&self, n: usize) -> Self {
        let v = self.v;
        let mut res = Self::new(1);
        for _ in 0..n {
            res *= v;
        }
        res
    }
}

impl<M: HasConstVal + Copy> ops::Add<i64> for ModBase<M> {
    type Output = Self;

    fn add(self, rhs: i64) -> Self {
        Self::new(self.v + rhs)
    }
}

impl<M: HasConstVal + Copy> ops::Add for ModBase<M> {
    type Output = Self;

    fn add(self, rhs: Self) -> Self {
        Self::new(self.v + rhs.v)
    }
}

impl<M: HasConstVal + Copy> ops::AddAssign<i64> for ModBase<M> {
    fn add_assign(&mut self, rhs: i64) {
        self.v = (self.v + rhs) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::AddAssign for ModBase<M> {
    fn add_assign(&mut self, rhs: Self) {
        self.v = (self.v + rhs.v) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::Sub<i64> for ModBase<M> {
    type Output = Self;

    fn sub(self, rhs: i64) -> Self {
        Self::new(self.v - rhs)
    }
}

impl<M: HasConstVal + Copy> ops::Sub for ModBase<M> {
    type Output = Self;

    fn sub(self, rhs: Self) -> Self {
        Self::new(self.v - rhs.v)
    }
}

impl<M: HasConstVal + Copy> ops::SubAssign<i64> for ModBase<M> {
    fn sub_assign(&mut self, rhs: i64) {
        self.v = (self.v - rhs) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::SubAssign for ModBase<M> {
    fn sub_assign(&mut self, rhs: Self) {
        self.v = (self.v - rhs.v) % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::Mul<i64> for ModBase<M> {
    type Output = Self;

    fn mul(self, rhs: i64) -> Self::Output {
        Self::new(self.v * rhs)
    }
}

impl<M: HasConstVal + Copy> ops::Mul for ModBase<M> {
    type Output = Self;

    fn mul(self, rhs: Self) -> Self::Output {
        Self::new(self.v * rhs.v)
    }
}

impl<M: HasConstVal + Copy> ops::MulAssign<i64> for ModBase<M> {
    fn mul_assign(&mut self, rhs: i64) {
        self.v = self.v * rhs % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::MulAssign for ModBase<M> {
    fn mul_assign(&mut self, rhs: Self) {
        self.v = self.v * rhs.v % M::VAL;
    }
}

impl<M: HasConstVal + Copy> ops::Div<i64> for ModBase<M> {
    type Output = Self;

    fn div(self, rhs: i64) -> Self::Output {
        self * Self::new(rhs).inv()
    }
}

impl<M: HasConstVal + Copy> ops::Div for ModBase<M> {
    type Output = Self;

    fn div(self, rhs: Self) -> Self::Output {
        self * rhs.inv()
    }
}

impl<M: HasConstVal + Copy> ops::DivAssign<i64> for ModBase<M> {
    fn div_assign(&mut self, rhs: i64) {
        self.v = (Self::new(self.v) / rhs).v;
    }
}

impl<M: HasConstVal + Copy> ops::DivAssign for ModBase<M> {
    fn div_assign(&mut self, rhs: Self) {
        self.v = (Self::new(self.v) / rhs).v;
    }
}

impl<M: HasConstVal + Copy> ops::Neg for ModBase<M> {
    type Output = Self;

    fn neg(self) -> Self::Output {
        Self::new(-self.v)
    }
}

impl<M: HasConstVal + Copy> ops::Deref for ModBase<M> {
    type Target = i64;

    fn deref(&self) -> &Self::Target {
        &self.v
    }
}

#[macro_export]
macro_rules! Mod {
    ($val: expr) => {
        Mod!(Mod, ModV, $val);
    };
    ($name: ident, $v_name: ident, $val: expr) => {
        #[derive(Copy, Clone, Eq, PartialEq)]
        pub struct $v_name {}

        impl crate::HasConstVal for $v_name {
            const VAL: i64 = $val as i64;
        }

        type $name = ModBase<$v_name>;
    };
}


Alexander is learning how to convert numbers from the decimal system to any other, however, he doesn't know English letters, so he writes any number only as a decimal number, it means that instead of the letter A he will write the number 10. Thus, by converting the number 475 from decimal to hexadecimal system, he gets 11311 (475 = 1·162 + 13·161 + 11·160). Alexander lived calmly until he tried to convert the number back to the decimal number system.Alexander remembers that he worked with little numbers so he asks to find the minimum decimal number so that by converting it to the system with the base n he will get the number k.

The first line contains the integer n (2 ≤ n ≤ 109). The second line contains the integer k (0 ≤ k < 1060), it is guaranteed that the number k contains no more than 60 symbols. All digits in the second line are strictly less than n. Alexander guarantees that the answer exists and does not exceed 1018. The number k doesn't contain leading zeros.

Print the number x (0 ≤ x ≤ 1018) — the answer to the problem.

NoteIn the first example 12 could be obtained by converting two numbers to the system with base 13: 12 = 12·130 or 15 = 1·131 + 2·130.

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

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

	let b = rin.l();
	let s = rin.vb();
	let n = s.len();
	let mut dp = v!([n+1] = std::i64::MAX);
	dp[0] = 0;
	for i in 0..n {
		let mut x = 0;
		for j in i..n {
			x = x * 10 + (s[j] - b'0') as i64;
			if (s[i] == b'0' && j > i) || x >= b {
				break;
			}
			min!(dp[j+1], dp[i].saturating_mul(b).saturating_add(x));
		}
	}
	writeln!(rout, "{}", dp[n]).ok();
}

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 solve() {
    let n = parse_line!(u64);
    let s: Vec<_> = parse_line!(String).bytes().map(|c| (c - b'0') as u64).collect();
    let l = s.len();
    let mut dp = vec![std::u64::MAX; l + 1];
    dp[0] = 0;
    let mut digits = vec![0; l + 1];
    for (i, &c) in s.iter().enumerate() {
        for j in (1..=i + 1).rev() {
            digits[j] = digits[j - 1] * 10 + c;
        }
        for j in 0..=i {
            if digits[j + 1] >= n {
                break;
            }
            if j > 0 && s[i - j] == 0 {
                continue;
            }
            dp[i + 1] = std::cmp::min(dp[i + 1], dp[i - j] * n + digits[j + 1]);
        }
    }
    println!("{}", dp[l]);
}

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

#[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 numero(v: &[i64], b: i64) -> Option<i64> {
    let mut cur: i64 = 0;
    for &t in v.iter() {
        cur = match cur.checked_mul(b) {
            Some(v) => v,
            None => return None,
        };
        cur = match cur.checked_add(t) {
            Some(v) => v,
            None => return None,
        }
    }
    Some(cur)
}

fn checked_propagate(b: i64, x: i64, y: i64) -> Option<i64> {
    let cur = match x.checked_mul(b) {
        Some(v) => v,
        None => return None,
    };
    cur.checked_add(y)
}

fn main() {
    let b: i64 = get();
    let s: Vec<_> = get_word().bytes().map(|b| b as i64 - 0x30).collect();
    let n = s.len();
    if b <= 9 {
        // simply read b-base rep.
        let mut cur = 0;
        for v in s {
            cur *= b;
            cur += v;
        }
        println!("{}", cur);
        return;
    }
    let mut dp = vec![-1i64; n + 1];
    const INF: i64 = 1i64 << 60;
    dp[0] = 0;
    for i in 1 .. n + 1 {
        let mut mi = INF;
        for j in 1 .. i + 1 {
            // s[i - j ..i] < b ?
            if j >= 10 || dp[i - j] < 0 || (j >= 2 && s[i - j] == 0) {
                continue;
            }
            let sl = numero(&s[i - j .. i], 10);
            match sl {
                Some(v) if v < b => match checked_propagate(b, dp[i - j], v) {
                    Some(v) => { mi = min(mi, v) },
                    None => {},
                },
                _ => {},
            }
        }
        if mi < INF {
            dp[i] = mi;
        }
    }
    //println!("{:?}", dp);
    println!("{}", dp[n]);
}

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

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

	let b = rin.l();
	let s = rin.vb();
	let n = s.len();
	let mut dp = v!([n+1] = std::i64::MAX);
	dp[0] = 0;
	for i in 0..n {
		let mut x = 0;
		for j in i..n {
			x = x * 10 + (s[j] - b'0') as i64;
			if (s[i] == b'0' && j > i) || x >= b {
				break;
			}
			min!(dp[j+1], dp[i] * b + x);
		}
	}
	writeln!(rout, "{}", dp[n]).ok();
}

#[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 numero(v: &[i64], b: i64) -> i64 {
    let mut cur = 0;
    for &t in v.iter() {
        cur *= b;
        cur += t;
    }
    cur
}

fn main() {
    let b: i64 = get();
    let s: Vec<_> = get_word().bytes().map(|b| b as i64 - 0x30).collect();
    let n = s.len();
    if b <= 9 {
        // simply read b-base rep.
        let mut cur = 0;
        for v in s {
            cur *= b;
            cur += v;
        }
        println!("{}", cur);
        return;
    }
    let mut dp = vec![-1i64; n + 1];
    const INF: i64 = 1i64 << 60;
    dp[0] = 0;
    for i in 1 .. n + 1 {
        let mut mi = INF;
        for j in 1 .. i + 1 {
            // s[i - j ..i] < b ?
            if j >= 10 || dp[i - j] < 0 || (j >= 2 && s[i - j] == 0) ||
                numero(&s[i - j .. i], 10) >= b {
                continue;
            }
            mi = min(mi, b * dp[i - j] + numero(&s[i - j .. i], 10));
        }
        if mi < INF {
            dp[i] = mi;
        }
    }
    println!("{}", dp[n]);
}


You are a lover of bacteria. You want to raise some bacteria in a box. Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hope to see exactly x bacteria in the box at some moment. What is the minimum number of bacteria you need to put into the box across those days?

The only line containing one integer x (1 ≤ x ≤ 109).

The only line containing one integer: the answer.

NoteFor the first sample, we can add one bacterium in the box in the first day morning and at the third morning there will be 4 bacteria in the box. Now we put one more resulting 5 in the box. We added 2 bacteria in the process so the answer is 2.For the second sample, we can put one in the first morning and in the 4-th morning there will be 8 in the box. So the answer is 1.

fn count(n: u32) -> u32 {
    if n == 1 {
        return 1;
    }

    if n % 2 == 1 {
        1 + count(n / 2)
    } else {
        count(n / 2)
    }
}

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

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

//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 }
    }};
}
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 ai(&mut self, n: usize) -> Vec<i32> {
        let mut a = Vec::with_capacity(n);
        for _ in 0..n { a.push(self.i()); }
        a
    }
}

fn main() {
    let mut input = WordReader::from_stdin();
    let mut n = input.i();
    let mut sol = 0;
    while n > 0 {
        sol += 1;
        n -= n & -n;
    }
    println!("{}", sol);
}

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

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

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

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

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

fn main() {
    let n = readln!(i32);
    println!("{}",solve(n));
}

use std::io::stdin;

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

	let mut ans: i8 = 0;
	for bit in 0..64 {
		if n & 1<<bit > 0 {
			ans += 1;
		}
	}
	println!("{}", ans);
}

// {{{ 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 (x, ) = R!(usize);
    let mut ans = 0;
    for i in 0.. {
        if (x >> i) == 0 {
            break;
        }
        ans += (x >> i) % 2;
    }
    println!("{}", ans);
}

use std::io;
fn main(){
    let mut s:String=String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut a:i64=s.trim().parse::<i64>().unwrap();
    let mut sum:i64=0;
    while a!=0{
        sum+=a%2;
        a/=2;
    }
    println!("{}",sum);
}

use std::io;

fn read_line() -> (i32) {
    let mut input = String::new();

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

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

    n
}

fn main(){

    let mut n  = read_line();
    let mut bacterias = 0;

    while n > 0 {
        bacterias += n % 2;
        n = n /2;
    }

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

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

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

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

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

    let mut ans = 0;

    for bit in 0..64 {
        if (n & (1<<bit)) > 0 {
            ans += 1;
        }
    }

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

#[allow(unused_imports)]
use std::io;
use std::cmp::{min, max};
use std::mem;
use std::str::FromStr;
pub struct Scanner<B> {
    reader: B,
    buffer: Vec<String>,
}

impl<B: io::BufRead> Scanner<B> {
    pub fn new(reader: B) -> Scanner<B> {
        Scanner {
            reader: reader,
            buffer: Vec::new(),
        }
    }

    /// Use "turbofish" syntax next::<T>() to select data type of next token.
    pub fn next<T: ::std::str::FromStr>(&mut self) -> T
        where
            T::Err: ::std::fmt::Debug,
    {
        if let Some(front) = self.buffer.pop() {
            front.parse::<T>().expect(&front)
        } else {
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("Line not read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
            self.next()
        }
    }

    pub fn next_vec<T: ::std::str::FromStr>(&mut self, len: usize) -> Vec<T>
        where
            T::Err: ::std::fmt::Debug,
    {
        (0..len).map(|_| self.next::<T>()).collect::<Vec<T>>()
    }
}

fn main1() {
    let stdin = io::stdin();
    let mut input = Scanner::new(stdin.lock());
    let n = input.next::<u64>();
    println!("{}", n.count_ones());

}

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

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

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

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

}

fn _main() {
    let mut scan = Scan::new();
    let mut n: usize = scan.next();
    let mut x: usize = 0;
    while n>0 {
        if n&1 == 1 {
            x += 1;
        }
        n >>= 1;
    }
    println!("{}", x);
}

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

use std::io;

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

fn main() {
    let n: usize = read_line().parse().unwrap();
    println!("{}", n.count_ones());
}

use std::io;

fn read_line() -> (i64) {
    let mut input = String::new();

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

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

    n
}

fn main(){

    let n  = read_line();

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

}

use std::io;

fn read_line() -> (f64) {
    let mut input = String::new();

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

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

    n
}

fn main(){

    let n  = read_line();

    let log = n.log2().floor();
    let bacterias = 1.0 + (n - (2.0 as f64).powf(log));

    println!("{}", bacterias as i64);
}


Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer n and then they take turns, starting from Mahmoud. In each player's turn, he has to choose an integer a and subtract it from n such that:  1 ≤ a ≤ n.  If it's Mahmoud's turn, a has to be even, but if it's Ehab's turn, a has to be odd. If the current player can't choose any number satisfying the conditions, he loses. Can you determine the winner if they both play optimally?

The only line contains an integer n (1 ≤ n ≤ 109), the number at the beginning of the game.

Output "Mahmoud" (without quotes) if Mahmoud wins and "Ehab" (without quotes) otherwise.

NoteIn the first sample, Mahmoud can't choose any integer a initially because there is no positive even integer less than or equal to 1 so Ehab wins.In the second sample, Mahmoud has to choose a = 2 and subtract it from n. It's Ehab's turn and n = 0. There is no positive odd integer less than or equal to 0 so Mahmoud wins.

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

    std::io::stdin().read_line(&mut input).expect("INPUT::Read line failed!");

    let number = input.trim().parse::<i32>().expect("NUMBER::Parse to i32 failed!");

    if number % 2 == 0 {
        println!("Mahmoud");
    }else {
        println!("Ehab");
    }
}

use std::io::stdin;

// M => choose EVEN and choose FIRST
// E => odd

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

    let number: u32 = buffer.trim().parse().expect("Error in parsing");

    if number % 2 == 0 {
        println!("Mahmoud");
    } else {
        println!("Ehab");
    }
}

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

    println!("{}", ["Mahmoud","Ehab"][input.u() % 2]);
}

use std::io;

fn get_winner(num: u32) -> &'static str {
    if num % 2 == 0 {
        "Mahmoud"
    } else {
        "Ehab"
    }
}

pub fn solution() -> io::Result<()> {
    let mut number = String::new();

    io::stdin().read_line(&mut number)?;
    let number = number.trim().parse::<u32>().unwrap();

    println!("{}", get_winner(number));
    Ok(())
}

fn main() {
    solution();
}

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

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut n = BufReader::new(std::io::stdin())
        .lines()
        .next()
        .unwrap()?
        .parse::<usize>()?;

    if n & 1 == 0 {
        println!("Mahmoud");
    } else {
        println!("Ehab");
    }

    Ok(())
}

fn main() {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).unwrap();
  let n : i32 = s.trim().parse().unwrap();
  println!("{}", if n%2==0 {"Mahmoud"} else {"Ehab"});
}

use std::io;

fn get_line() -> io::Result<String> {
	let mut buffer = String::new();

	io::stdin().read_line(&mut buffer)?;
	Ok(buffer)
}

fn main() {
	let input = get_line().unwrap();
	let n: u32 = input.trim().parse().unwrap();

	print!("{}", if n % 2 == 0 { "Mahmoud" } else { "Ehab" });
}

use std::io;

fn main() {

    let mut line = String::new();
    io::stdin().read_line(&mut line).expect("Failed to read line");
    let n = line.trim().parse::<u64>().unwrap();

    if n % 2 == 0 {
        println!("Mahmoud")
    } else {
        println!("Ehab")
    }
}

fn main() {
    use std::io::prelude::*;
    use std::io;

    let mut input = String::new();

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

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

    if n % 2 == 1 {
        println!("Ehab");
    } else {
        println!("Mahmoud");
    }
}

use std::io;

fn main() {
	let mut n = String::new();
	io::stdin().read_line(&mut n).expect("Time to panic");
	let n: u64 = n.trim().parse().unwrap();
	if n % 2 != 0 {
		println!("Ehab");
	} else {
		println!("Mahmoud")
	}
}

use std::io;

pub fn main() {
    let input = get_input();
    match input % 2 {
        0 => println!("Mahmoud"),
        _ => println!("Ehab"),
    };
}

fn get_input() -> u64 {
    let mut input = String::new();
    io::stdin().read_line(&mut input);
    input.trim().parse::<u64>().unwrap()
}

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

    let ans = match num % 2 {
        0 => &"Mahmoud",
        1 => &"Ehab",
        _ => &"",
    };

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

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 n: usize = scan.next();
    println!("{}", if n % 2 == 0 { "Mahmoud" } else { "Ehab" });
}

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

use procon::*;
use std::io;
fn main() {
    try_main().unwrap();
}

fn try_main() -> Result<(), Box<std::error::Error>> {
    let stdin = io::stdin();
    let mut sc = Scanner::new(stdin.lock());
    let n = sc.next::<usize>();
    if n % 2 == 0 {
        println!("Mahmoud");
    } else {
        println!("Ehab");
    }
    Ok(())
}

mod procon {
    use std::io;
    use std::cmp::Ordering;
    /// Scanner is taken from https://github.com/EbTech/rust-algorithms
    pub struct Scanner<B> {
        reader: B,
        buffer: Vec<String>,
    }

    impl<B: io::BufRead> Scanner<B> {
        pub fn new(reader: B) -> Self {
            Self {
                reader,
                buffer: Vec::new(),
            }
        }

        pub fn next<T: ::std::str::FromStr>(&mut self) -> T
            where
            T::Err: ::std::fmt::Debug,
        {
            if let Some(front) = self.buffer.pop() {
                front.parse::<T>().expect(&front)
            } else {
                let mut input = String::new();
                self.reader.read_line(&mut input).expect("Line not read");
                self.buffer = input.split_whitespace().rev().map(String::from).collect();
                self.next()
            }
        }
    }

    pub fn merge<'a, T>(this: &'a [T], that: &'a [T], out: &'a mut [T])
        where T: Ord + Copy {
        let mut i = 0;
        let mut j = 0;
        let mut oind = 0;
        while i < this.len() && j < that.len() {
            if this[i] <= that[j] {
                out[oind] = this[i];
                i += 1;
            } else {
                out[oind] = that[j];
                j += 1;
            }
            oind += 1;
        }
        while i < this.len() {
            out[oind] = this[i];
            i += 1;
            oind += 1;
        }
        while j < that.len() {
            out[oind] = that[j];
            j += 1;
            oind += 1;
        }
    }

    /// trait for implementing functions to get lower/upper bounds (implementation is based on the rust std library)
    /// the functions return OK(indx) if self[indx] is the element we queried.
    /// e.g., in lower_bound_by, f(self[indx]) returns Ordering::Equal if the function returned Ok(indx).
    /// Further, if all the elements are less than the queried value, lower_bound/upper_bound must return Err(self.len()).
    /// Similarly, all the elements are greater than the queried value, they must return Err(0).
    pub trait CmpSearch {
        type Item;

        fn find_bound_by<'a, F>(&'a self, f: F, is_lower: bool) -> Result<usize, usize>
            where F: FnMut(&'a Self::Item) -> Ordering;

        fn find_bound_by_key<'a, B, F>(&'a self, b: &B, f: F, is_lower: bool) -> Result<usize, usize>
            where F: FnMut(&'a Self::Item) -> B,
                  B: Ord;

        /// returns Result<usize, usize> which contains the lowest index indx that satisfies the following condition,
        /// assuming that self is already sorted:
        /// 1. self[i] < x if i < indx
        /// 2. self[i] >= x if i >= indx
        /// 3. self.insert(indx, x) keeps the sorted order.
        /// The return value is Ok(indx) if there is an index that satisfies x.cmp(self[indx]) == Ordering::Equal.
        /// Otherwise the return value is Err(indx).
        ///
        fn lower_bound(&self, x: &Self::Item) -> Result<usize, usize>
            where Self::Item: Ord {
            self.find_bound_by(|elem| { elem.cmp(x) }, true)
        }

        /// returns Result<usize, usize> which contains the highest index indx that satisfies the following condition,
        /// assuming that self is already sorted:
        /// 1. self[i] <= x if i <= indx
        /// 2. self[i] > x if i > indx
        /// 3. self.insert(indx, x) keeps the sorted order.
        /// The return value is Ok(indx) if there is an index that satisfies x.cmp(self[indx]) == Ordering::Equal.
        /// Otherwise the return value is Err(indx).
        ///
        fn upper_bound(&self, x: &Self::Item) -> Result<usize, usize>
            where Self::Item: Ord {
            self.find_bound_by(|elem| { elem.cmp(x) }, false)
        }
    }

    impl<T> CmpSearch for [T] {
        type Item = T;

        /// loop invariants (if is_lower = true):
        /// 1. f(self[lb]) == Less, assuming that lb >= 0
        /// 2. f(self[ub]) == Greater or Equal, assuming that gb < self.len()
        /// 3. lb < ub; in particular, lb != ub
        ///
        /// after the loop:
        /// 1. if ub < self.len(), ub is a valid index in the slice
        /// 2. if lb == -1, ub == 0 and:
        ///   2-1. f(self[0]) == Equal then the return value is Ok(0)
        ///   2-2. f(self[0]) == Greater then the return value is Err(0)
        /// 3. if ub == self.len(), lb == self.len() - 1 and the return value is Err(self.len())
        ///
        /// a similar set of conditions holds if is_lower = false.
        ///
        fn find_bound_by<'a, F>(&'a self, mut f: F, is_lower: bool) -> Result<usize, usize>
            where F: FnMut(&'a Self::Item) -> Ordering {
            let mut lb: isize = -1;
            let mut ub: isize = self.len() as isize;
            let mut step = (ub - lb) / 2;
            while step > 0 {
                let m = (lb + step) as usize;
                match f(&self[m]) {
                    Ordering::Less => {
                        lb = m as isize;
                    },
                    Ordering::Greater => {
                        ub = m as isize;
                    },
                    Ordering::Equal => {
                        if is_lower {
                            ub = m as isize;
                        } else {
                            lb = m as isize;
                        }
                    }
                }
                step = (ub - lb) / 2
            }

            if is_lower {
                if ub as usize == self.len() {
                    Err(self.len())
                } else {
                    let ub = ub as usize;
                    match f(&self[ub]) {
                        Ordering::Equal => {
                            Ok(ub)
                        },
                        _ => {
                            Err(ub)
                        }
                    }
                }
            } else {
                if lb == -1 {
                    Err(0)
                } else {
                    let lb = lb as usize;
                    match f(&self[lb]) {
                        Ordering::Equal => {
                            Ok(lb)
                        },
                        _ => {
                            Err(lb+1)
                        }
                    }
                }
            }
        }

        fn find_bound_by_key<'a, B, F>(&'a self, b: &B, mut f: F, is_lower: bool) -> Result<usize, usize>
            where F: FnMut(&'a Self::Item) -> B,
                  B: Ord {
            self.find_bound_by(|elem|{ f(elem).cmp(b) }, is_lower)
        }

    }
}

#[cfg(test)]
mod tests {
    use super::procon::*;

    #[test]
    fn test_find_bound_by() {
        let s = [0, 2, 2, 2, 4];
        // lower bound
        let seek = 2;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), true), Ok(1));
        let seek = 1;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), true), Err(1));
        let seek = -1;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), true), Err(0));
        let seek = 5;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), true), Err(5));
        // upper bound
        let seek = 2;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), false), Ok(3));
        let seek = 1;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), false), Err(1));
        let seek = 5;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), false), Err(5));
        let seek = -1;
        assert_eq!(s.find_bound_by(|probe| probe.cmp(&seek), false), Err(0));
    }
}

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

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

use std::io::Write;

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

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

use std::io;

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

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

    let n = input.trim().parse::<usize>().unwrap();

    match n % 2 {
        0 => println!("Mahmoud"),
        1 => println!("Ehab"),
        _ => println!("Invalid number"),
    }

    Ok(())
}

use std::io;

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

    io::stdin().read_line(&mut val)
        .expect("Не удалось прочитать строку");

    let val: u32 = val.trim().parse()
        .expect("Пожалуйста, введите число!");

    if val % 2 == 0 {
        println!("Mahmoud");
    } else {
        println!("Ehab");
    }
}

use std::io;

fn main() {
  let mut ni = String::new();
  io::stdin().read_line(&mut ni).unwrap();
  let n: i32 = ni.trim().parse().unwrap();
  println!("{}", if (n % 2) == 0 { "Mahmoud" } else { "Ehab" });
}

#[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: usize = scan.next ();
    println! ("{}", if n%2 == 0 {"Mahmoud"} else {"Ehab"});
}

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

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

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

    if num % 2 == 0 {
        println!("Mahmoud");
    } else {
        println!("Ehab");
    }
}

use std::io::stdin;

// M => choose EVEN and choose FIRST
// E => odd

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

    let number: u32 = buffer.trim().parse().expect("Error in parsing");

    if number % 2 == 0 {
        println!("Mahmoud");
    } else {
        println!("Ehad");
    }
}

use std::io;

fn get_line() -> io::Result<String> {
	let mut buffer = String::new();
	io::stdin().read_line(&mut buffer)?;
	Ok(buffer)
}

fn main() {
	let employees;
	{
		let input = get_line().unwrap();
		employees = input.trim().parse::<u32>().unwrap();
	}

	let mut ways = 0;
	for i in 1..employees {
		if (employees - i) % i == 0 {
			ways += 1;
		}
	}
	print!("{}", ways);
}

use std::io;

fn main() {
	let mut n = String::new();
	io::stdin().read_line(&mut n).expect("Time to panic");
	let n: u64 = n.trim().parse().unwrap();
	if n % 2 == 0 {
		println!("Ehab");
	} else {
		println!("Mahmoud")
	}
}

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

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

use std::io::Write;

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

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