use std::io;

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(),
            )+
        )
    }}
}

fn can_be_splitted(slice : &[i32], sum : i32) -> bool {
    let mut curr_sum = 0;
    let mut index = 0;
    let mut at_least_one = false;
    loop {
        if index >= slice.len() {
            return at_least_one;
        }

        curr_sum += slice[index];
        if curr_sum == sum {
            curr_sum = 0;
            at_least_one = true;
        } else if curr_sum > sum {
            return false;
        }
        index += 1;
    }

    true
}

fn solve(length : usize, digits : Vec<i32>) -> (bool, i32) {
    let mut curr_sum = 0;
    for index in 0..(length - 1) {
        curr_sum += digits[index];
        if can_be_splitted(&digits[(index + 1)..], curr_sum) {
            return (true, curr_sum);
        }
    }
    (false, 0)
}

fn main() {
    let length = readln!(usize);

    let digits = readln!();
    let digits : Vec<i32> = digits.chars().map(|ch| ch.to_digit(10).unwrap() as i32).collect();

    let (result, sum) = solve(length, digits);

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


use std::io;

fn main() {
    let n = {
        let mut buffer = String::new();
        io::stdin().read_line(&mut buffer).unwrap();
        buffer.trim().parse().unwrap()
    };
    let nums : Vec<u64> = {
        let mut buffer = String::with_capacity(n);
        let mut char_str = String::from("0");
        io::stdin().read_line(&mut buffer).unwrap();
        buffer
        .trim()
        .chars()
        .map(|x| {
            char_str.pop();
            char_str.push(x);
            char_str.trim().parse().unwrap()
        })
        .collect()
    };
    let mut iter = nums.iter();
    let mut sum = 0;
    {
        let mut sum_rest : u64 = nums.iter().fold(0, |acc, x| acc + x);
        while let Some(x) = iter.next() {
            sum_rest -= x;
            sum += x;
            if sum_rest % sum == 0 {
                break
            }
        }
        if sum_rest == 0 {
            println!("NO");
            return
        }
    }
    let mut sum2 = 0;
    while let Some(x) = iter.next() {
        sum2 += x;
        if sum2 == sum {
            sum2 = 0;
        }
    }
    if sum2 == 0 {
        println!("YES")
    } else {
        println!("NO")
    }
}


use std::io;
use std::slice::Iter;

fn check_step(iter : &mut Iter<u64>, check_sum : u64) -> Option<bool> {
    if iter.as_slice().len() == 0 { return None }
    let mut sum = 0;
    while let Some(x) = iter.next() {
        sum += x;
        if sum == check_sum {
            return Some(true)
        }
    }
    Some(false)
}

fn check(mut iter : Iter<u64>, check_sum : u64) -> bool {
    if iter.as_slice().len() == 0 { return false }
    while let Some(flag) = check_step(&mut iter, check_sum) {
        if !flag {
            return false
        }
    }
    true
}

fn main() {
    let n = {
        let mut buffer = String::new();
        io::stdin().read_line(&mut buffer).unwrap();
        buffer.trim().parse().unwrap()
    };
    let nums : Vec<u64> = {
        let mut buffer = String::with_capacity(n);
        let mut char_str = String::from("0");
        io::stdin().read_line(&mut buffer).unwrap();
        buffer
        .trim()
        .chars()
        .map(|x| {
            char_str.pop();
            char_str.push(x);
            char_str.trim().parse().unwrap()
        })
        .collect()
    };
    let mut iter = nums.iter();
    let mut sum = 0;
    let mut sum_rest : u64 = nums.iter().fold(0, |acc, x| acc + x);
    while let Some(x) = iter.next() {
        sum_rest -= x;
        sum += x;
        if sum_rest.checked_rem(sum).map(|x| x == 0).unwrap_or_else(|| sum == sum_rest) {
            if check(iter.clone(), sum) {
                println!("YES");
                return
            }
        }
    }
    println!("NO");
}


#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
#[allow(dead_code)]
pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer)
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) } ; }
#[allow(dead_code)]
fn main() {
    input!{
        w: i64,
        h: i64,
        u1: i64,
        d1: i64,
        u2: i64,
        d2: i64,
    }
    let mut ans = w;
    let mut height = h;
    while height > 0 {
        ans += height;
        if d1 == height {
            ans -= u1;
        }
        if d2 == height {
            ans -= u2;
        }
        height -= 1;
    }
    println!("{}", ans);
}


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

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

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

fn get_vec<T>(s: String) -> Vec<T>
    where T: FromStr,
          <T as FromStr>::Err: std::fmt::Debug,
{
    s.split_whitespace().map(|k| k.parse().unwrap()).collect()
}

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

    let (a, b) = if n % 2 == 0 {
        (n / 2 - 1, n / 2 + 1)
    } else {
        (n / 2, n / 2 + 1)
    };

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


use std::io;

fn main() {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let n: u32 = line.trim().parse().unwrap();
    let a = n / 2;
    println!("{} {}", a - (1 - n % 2), a + 1);
}


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

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

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

fn main() {
    let (mut n, ) = scan_line!(i64);

    n -= 3;
    let mut numerator = 1;
    let mut denominator = 2;

    while n >= 1 {
        if numerator + 1 < denominator {
            numerator += 1;
        } else {
            denominator += 1;
        }
        n -= 1;
    }

    println!("{} {}", numerator, denominator);
}


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

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

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

fn get_vec<T>(s: String) -> Vec<T>
    where T: FromStr,
          <T as FromStr>::Err: std::fmt::Debug,
{
    s.split_whitespace().map(|k| k.parse().unwrap()).collect()
}

fn gcd(a: u32, b: u32) -> u32 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    let (n, k): (u32, u32) = {
        let input = get_line();
        let mut it = input.split_whitespace().map(|k| k.parse().unwrap());
        (it.next().unwrap(),
        it.next().unwrap())
    };

    let min_val = if k == 0 || k == n {
        0
    } else {
        1
    };

    let q = n / 3;
    let r = n % 3;

    let max_val = if k <= q {
        2 * k
    } else if k <= q + r {
        2 * q + if r > 1 {1} else {0}
    } else {
        n - k
    };

    println!("{} {}", min_val, max_val);
}


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

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

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

fn main() {
    let (n, k) = scan_line!(i64 i64);

    let m = if n == k || k == 0 { 0 } else { 1 };
    let M = if k == 0 {
        0
    } else if k == n/2 {
        if n % 2 == 0 {
            k
        } else {
            k + 1
        }
    } else if k > n/2 {
        n - k
    } else {
        k + 1
    };

    println!("{} {}", m, M);

}


fn main() {
  use std::io;
  use std::str::FromStr;
  use std::cmp::min;
  use std::cmp::max;

  let stdin = io::stdin();
  let mut line = String::new();
  stdin.read_line(&mut line).ok();
  let s_line : Vec<&str> = line.split(' ').collect();
  let n : i64 = i64::from_str(s_line[0].trim()).unwrap();
  let k : i64 = i64::from_str(s_line[1].trim()).unwrap();
  let ans_min = min(1, n-k);
  let mut ans_max = 2*min(n/3, k) - max((k-min(n/3, k)) - n%3, 0);
  if (k-min(n/3, k))==1 && n%3==2{
    ans_max += 1;
  }
  println!("{0} {1}", ans_min, ans_max);
}


/*
 *
 * Author : fcbruce <fcbruce8964@gmail.com>
 *
 * Time : Sat 10 Feb 2018 18:51:25
 *
 */
// n - c, m - o
//
// 6 3
//
// 2x + y = n
// 1 + y = m
//
// y = 2

fn check(copy: i32, origin: i32) -> bool {
  let y = origin - 1;
  let x = copy - y;

  return x >= 0 && y >= 0 && x % 2 == 0;
}

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

  let mut numbers = buffer.split_whitespace();

  let copy:i32 = numbers.next().unwrap().parse().unwrap();
  let origin:i32 = numbers.next().unwrap().parse().unwrap();

  if check(copy, origin) {
    println!("Yes");
  } else {
    println!("No");
  }

}


use std::io;

fn main() {

    let mut str = String::new();

    io::stdin().read_line(&mut str).expect("You are failure");

    let mut vals = [0; 2];

    let str = str.trim().split(" ");

    let mut f = 0;
    for i in str{
        vals[f] = i.parse().expect("err");
        f+=1;
    }

    let mut printable = true;

    if vals[1] == 0 || (vals[0]%2 == vals[1]%2) || (vals[1]==1 && vals[0] != 0) || vals[0] > vals[1] + 1{
        printable = false;
    }

    println!("{}", if printable {"YES"} else {"NO"});

}


use std::io::{self, BufRead};
// use std::collections::*; // HashSet, HashMap, BTreeSet, BTreeMap, ...

fn main() {
    let stdin: io::Stdin = io::stdin();
    let mut lines: io::Lines<io::StdinLock> = stdin.lock().lines();

    let next_line = lines.next()
        .unwrap() // Option<Result> { Some(Result), None }
        .unwrap(); // Result<String, io::Error> { Ok(String), Err(io::Error) }

    let flv: Vec<_> = next_line
        .trim()
        .split(' ')
        .map(|n| {
            n.parse::<usize>().unwrap()
        })
        .collect();

    let n = flv[0];

    let mut s: String = lines.next()
        .unwrap()
        .unwrap()
        .trim()
        .to_string();

    for i in 2..n {
        if n % i == 0 {
            let tmp_end = s.split_off(i);
            s = s.chars().rev().collect();
            s.push_str(&tmp_end);
            println!("{}: {}", i, s);
        }
    }
    s = s.chars().rev().collect();

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


use std::io;

fn main() {

    let mut input_text = String::new();
    io::stdin().read_line(&mut input_text).expect("fail");
    let n = input_text.trim().parse::<u32>().expect("parse error");

    let mut string = String::new();
    io::stdin().read_line(&mut string).expect("fail");

    let string = string.chars();

    let mut vec = Vec::new();
    for c in string {
        vec.push(c);
    }

    for d in 1..n+1 {
        if n % d == 0 {
            for i in 0..d/2+1 {
                let t = vec[i as usize];
                vec[i as usize] = vec[d as usize - i as usize - 1usize];
                vec[d as usize - i as usize - 1usize] = t;
            }
        }
    }
    for i in 0..n {
        print!("{}", vec[i as usize]);
    }
}


fn main() {
    let (n, k) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let buf: Vec<u16> = buf
            .trim()
            .split_whitespace()
            .map(|a| a.parse::<u16>().unwrap())
            .collect();
        (buf[0], buf[1])
    };

    let time_left = 240u16 - k;
    let nums: Vec<u16> = (1u16..=n).collect();
    let mut result = nums[n as usize-1];
    for i in 0..nums.len() {
        let a = nums[i];
        if 5u16 * a * (a - 1u16) / 2u16 > time_left {
            result = i as u16 - 1;
            break;
        }
    }
    println!("{}", result);
}


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

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

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

fn main() {
    let (n,m,a,b) = readln!(i32,i32,i32,i32);
    let r1 = n*a;
    let r2 = b*((n+m-1)/m);
    let r3 = b*(n/m) + a*(n%m);
    println!("{}", std::cmp::min(r1,std::cmp::min(r2,r3)));
}


#[allow(dead_code)]
use std::cmp::min;
use std::collections::HashMap;
use std::io;
use std::str::FromStr;
use std::io::Read;

struct Input {
  tokens: <std::vec::Vec<std::string::String> as IntoIterator>::IntoIter,
  read_all: bool,
}

impl Input {
  pub fn new(read_all: bool) -> Input {
    if read_all {
      let mut all = String::new();
      io::stdin().read_to_string(&mut all).unwrap();
      let tokens: Vec<String> = all.split_whitespace().map(|s| s.to_string()).collect();
      Input {
        tokens: tokens.into_iter(),
        read_all: true,
      }
    } else {
      Input {
        tokens: vec!().into_iter(),
        read_all: false,
      }
    }
  }

  fn refresh_next_line(&mut self) {
    if self.read_all {
      panic!();
    }
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let tokens: Vec<String> = buf.split_whitespace().map(|s| s.to_string()).collect();
    self.tokens = tokens.into_iter();
  }

  fn next_impl(&mut self) -> String {
    loop {
      if let Some(next) = self.tokens.next() {
        return next.to_string();
      }
      self.refresh_next_line();
    }
  }

  pub fn next<T: FromStr>(&mut self) -> T where <T as std::str::FromStr>::Err: std::fmt::Debug {
    let next_str = self.next_impl();
    next_str.parse().unwrap()
  }

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

  pub fn next_vec_read_len<T: FromStr>(&mut self) -> Vec<T> where <T as std::str::FromStr>::Err: std::fmt::Debug {
    let len = self.next();
    self.next_vec(len)
  }
}

fn main() {
  let mut input = Input::new(false);
  let n: i64 = input.next();
  let k: i64 = input.next();
  let mut time = 240 - k;
  let mut i = 1;
  while time > i * 5 {
    time -= i * 5;
    i += 1
  }
  println!("{}", i - 1);

}


use std::io;

fn main() -> std::io::Result<()> {
    let stdin = io::stdin();
    let mut input = String::new();
    stdin.read_line(&mut input)?;
    let problems_travel: Vec<i16> = input.trim().split(" ").map(|x| x.parse::<i16>().unwrap()).collect();
    let minutes_left: i16 = 240 - problems_travel[1];
    for p in 1..=problems_travel[0] {
        if minutes_left - p * 5 < 0 {
            print!("{}", p-1);
            break;
        } else if p == problems_travel[0] {print!("{}",p);}
    }

    Ok(())
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        n : i32,
        k : i32,
    };
    let mut time = k;
    for i in 0..n {
        time += (i + 1) * 5;
        println!("{}", time);
        if time > 240 {
            println!("{}", i);
            return;
        }
    }
    println!("{}", n);
}


use std::io;

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(),
            )+
        )
    }}
}

fn is_prime(num : i128) -> bool {
    if num == 1 || num != 2 && num % 2 == 0 {
        return false;
    }
    let limit = (num as f64).sqrt() as i128 + 1;
    let mut div = 3;
    while div <= limit {
        if num % div == 0 {
            return true;
        }
        div += 1;
    }
    return true;
}

fn main() {
    let tests = readln!(u8);
    for _ in 0..tests {
        let (size1, size2) = readln!(i128, i128);

        if size1 - size2 == 1 {
            println!("{}", if is_prime(size1 + size2) { "YES" } else { "NO" });
        } else {
            println!("NO");
        }
    }
}


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

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

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

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

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let t: u32 = scan.token();
    for _ in 0..t {
        let a: i64 = scan.token();
        let b: i64 = scan.token();
        if a - b == 1 {
            writeln!(out, "YES").ok();
        } else {
            writeln!(out, "NO").ok();
        }
    }
}

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


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

fn main() {
    let mut buffer = String::new();
    let stdin = io::stdin();
    let mut handle = stdin.lock();
    handle.read_to_string(&mut buffer).unwrap();

    let arr : Vec<_> = buffer.split_whitespace().map(|x| x.parse::<u64>().unwrap() ).collect();
    let t = arr[0] as usize;
    let mut index = 1;
    for _ in 0..t {
        let (a,b) = (arr[index],arr[index+1]);
        if b == a-1 {
            let h = 2*b+1; // = a+b
            let mut j = 3; //just check all odd numbers since 2b + 1 is odd
            let mut divisible = false;
            while j <= (h as f64).sqrt() as u64 + 1{
                if h % j == 0 {
                    divisible = true;
                }
                j += 2;
            }
            println!("{},{}: {}",a,b,divisible);
            if !divisible {
                println!("YES");
            } else {
                println!("NO");
            }
        } else {
            println!("NO");
        }
        index += 2;
    }
}


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

fn main() {
    let mut buffer = String::new();
    let stdin = io::stdin();
    let mut handle = stdin.lock();
    handle.read_to_string(&mut buffer).unwrap();

    let arr : Vec<_> = buffer.split_whitespace().map(|x| x.parse::<u64>().unwrap() ).collect();
    let t = arr[0] as usize;
    let mut index = 1;
    for _ in 0..t {
        let (a,b) = (arr[index],arr[index+1]);
        if b == a-1 {
            let h = 2*b+1;
            let mut j = 3;
            let mut divisible = false;
            while j < h/2+1 {
                if h % j == 0 {
                    divisible = true;
                }
                j += 2;
            }
            if !divisible {
                println!("YES");
            } else {
                println!("NO");
            }
        } else {
            println!("NO");
        }
        index += 2;
    }
}


use std::io;

fn main() {

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

    let vector: Vec<&str> = string.split("\n").collect();

    if vector[1].chars().eq(vector[0].chars().rev()) {
        println!("YES");
    } else {
        println!("NO");
    }

}


use std::io;

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

    let vector: Vec<&str> = input.split(" ").collect();
    let first_vector = vector[0].to_string();
    let second_vector: String = vector[1].trim().chars().rev().collect();

    if first_vector.eq(&second_vector) {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

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

    let mut t = String::new();
    io::stdin()
        .read_line(&mut t)
        .unwrap()
        .graphemes(true)
        .rev()
        .collect();

    if s == t {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;
fn main(){
    let mut s:String=String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut c:usize=0;
    let mut n:usize=0;
    let mut a:Vec<i32>=Vec::new();
    while c<s.len()-1{
        n=c;
        if s.chars().nth(c).unwrap()!=' '{
            while s.chars().nth(n).unwrap()!=' ' && n<s.len()-1{
                n+=1;
            }
            a.push(s[c..n].trim().to_string().parse().unwrap());
            c=n;
        }
        c+=1;
    }
    let a=a[1];
    let mut s:String=String::new();
    io::stdin().read_line(&mut s).unwrap();
    n=0;
    c=0;
    let mut b:Vec<i32>=Vec::new();
    while c<s.len()-1{
        n=c;
        if s.chars().nth(c).unwrap()!=' '{
            while s.chars().nth(n).unwrap()!=' ' && n<s.len()-1{
                n+=1;
            }
            b.push(s[c..n].trim().to_string().parse().unwrap());
            c=n;
        }
        c+=1;
    }
    let mut n:i32=a;
    for c in 0..b.len(){
        if n<a/b[c] && a%b[c]==0{
            n=a/b[c];
        }
    }
    println!("{}",n)
}


use std::io;

fn main() {
    let mut a_str = String::new();
    io::stdin().read_line(&mut a_str).expect("");
    let mut num = a_str.split_whitespace()
        .map(|x| x.parse::<i32>().expect("parse error"))
        .collect::<Vec<i32>>();
     io::stdin().read_line(&mut a_str).expect("");
    let mut v = a_str.split_whitespace()
        .map(|x| x.parse::<i32>().expect("parse error"))
        .collect::<Vec<i32>>();

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

    let mut res = 0;
    v.sort();
    v.reverse();
    for i in &v {
        if k % i == 0 {
            res = k / i;
            break;
        }
    }
    println!("{}", res);

}


use std::io;

fn main() {
    let mut a_str = String::new();
    io::stdin().read_line(&mut a_str).expect("");
    let mut num = a_str.split_whitespace()
        .map(|x| x.parse::<i32>().expect("parse error"))
        .collect::<Vec<i32>>();
     io::stdin().read_line(&mut a_str).expect("");
    let mut v = a_str.split_whitespace()
        .map(|x| x.parse::<i32>().expect("parse error"))
        .collect::<Vec<i32>>();

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

    let mut res = 0;
    v.sort().reverse();
    for i in &v {
        if k % i == 0 {
            res = k / i;
            break;
        }
    }
    println!("{}", res);

}


use std::io;
use std::fs::File;

fn main() {
    let stdin = io::stdin();
    let buf :Box<io::BufRead> = if cfg!(feature = "intxt") {
        eprintln!("file mode");
        let file = File::open("in.txt").unwrap();
        Box::new(io::BufReader::new(file))
    } else {
        eprintln!("stdin mode");
        Box::new(stdin.lock())
    };
    let mut sc = Scanner::new(buf);

    let n :i32 = sc.next();
    let mut vec = Vec::new();
    for _ in 0..n {
        let a :i32 = sc.next();
        vec.push(a);
    }
    vec.sort();
    let mut a = vec[0];
    let mut cnt = 1;
    for x in vec {
        if x != a {
            a = x;
            if x > 0 { cnt += 1}
        }
    }
    println!("{}", cnt);
}

struct Scanner<B: io::BufRead> {
    reader: B,
    buffer: Vec<String>,
}

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

    fn next<T: std::str::FromStr>(&mut self) -> T
    where
        T::Err: std::fmt::Debug,
    {
        if let Some(s) = self.buffer.pop() {
            T::from_str(&s).unwrap()
        } else {
            let mut s = String::new();
            let r = self.reader.read_line(&mut s).unwrap();
            assert!(r > 0);
            self.buffer = s.split_whitespace().rev().map(String::from).collect();
            return self.next();
        }
    }
}


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

    let mut it = input.split_whitespace();

    let n: usize = it.next().unwrap().parse().unwrap();

    let a: Vec<usize> = it.map(|x| x.parse().unwrap()).collect();

    let mut set = [false; 600];

    for a in a {
        set[a] = true;
    }

    let ans = set[1..].iter().filter(|&&x| x).count();

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


macro_rules! parse {
    () => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap(); // don't do this
        s.trim().parse().unwrap() // don't do this
    }};
}

fn main() {
    let s: String = parse!();
    let input: Vec<usize> = s.split_whitespace().map(|f| f.trim()).map(|s| s.parse().unwrap()).collect();
    let participants = input[0];
    let pens = input[1];
    let notebooks = input[2];
    if participants < pens || participants < notebooks{
        println!("No");
    }else {
        println!("Yes");
    }
}


/*
    Implementation, strings - https://codeforces.com/problemset/problem/281/A
    Completed: 4/7/20 3:43
*/

use std::io;

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

    let vector: Vec<&str> = input.trim().split(" ").collect();

    let participants = vector[0].parse::<u16>().unwrap();
    let pens  = vector[1].parse::<u16>().unwrap();
    let notebooks  = vector[2].parse::<u16>().unwrap();

    if (participants < pens) & (participants < notebooks) {
        println!("Yes");
    } else {
        println!("No");
    }

}


use std::io;

fn main() {
  let mut i = String::new();
  io::stdin().read_line(&mut i).unwrap();
  let h: Vec<i32> = i.split(" ").map(|s| s.trim()).map(|s| s.parse().unwrap()).collect();
   println!("{}", if (h[0] <= h[1]) && (h[0] < h[2]) { "Yes" } else { "No "});
}


fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("???");
    let arbuz: u32 = input.trim().parse().expect("???");
    if (arbuz > 2) && (arbuz % 2 == 0) {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io;

macro_rules! parse_line {
    ($($t: ty),+) => ({
        let mut a_str = String::new();
        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"),
            )+
        )
    })
}

fn main() {
    let (x,y,z) = parse_line!(i128, i128, i128);
    let a = (x+z-1)/z*(y+z-1)/z;
    println!("{}", a);
}


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

  let mut ws = s.split_whitespace();
  let n: i64 = ws.next().unwrap().parse().unwrap();
  let m: i64 = ws.next().unwrap().parse().unwrap();
  let a: i64 = ws.next().unwrap().parse().unwrap();

  // ceil(n/a) * ceil(m/a)
  println!("{}", (n+a-1)/a * (m+a-1)/a);
}

/* vim: set ts=2 sts=2 sw=2 et: */


fn main(){
    let mut line=String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut line:Vec<char>=line.trim().chars().collect();
    let mut s:usize=0;
    let mut e:usize=line.len()-1;
    while s<e{
        while line[s]<'2'{s+=2}
        while line[e]>'2'{e-=2}
        if s<e{
            let k=line[s];
            line[s]=line[e];
            line[e]=k;
        }
    }
    for c in &line{
        print!("{}",c);
    }
}


fn main(){
    let mut line=String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut line:Vec<char>=line.trim().chars().collect();
    let mut s:i32=0;
    let mut e:i32=line.len() as i32-1;
    while s<e{
        while line[s as usize]<'2'{s+=2}
        while line[e as usize]>'2'{e-=2}
        if s<e{
            let k=line[s as usize];
            line[s as usize]=line[e as usize];
            line[e as usize]=k;
            s+=2;
            e-=2;
        }
    }
    for c in &line{
        print!("{}",c);
    }
}


use std::io;

fn main() -> std::io::Result<()> {
    let stdin = io::stdin();
    let mut input = String::new();
    stdin.read_line(&mut input)?;
    print!("{}", helpfulmath(input));
    Ok(())
}

fn helpfulmath(input: String) -> String {
    let mut sequence : Vec<&str> = input.as_str()
        .split('+')
        .collect();
    sequence.sort();
    sequence.join(&"+")
}
#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test() {
        assert_eq!(helpfulmath("1+1+3+1+3".to_string()), "1+1+1+3+3".to_string());
        assert_eq!(helpfulmath("2".to_string()), "2".to_string());
        assert_eq!(helpfulmath("3+2+1".to_string()), "1+2+3".to_string());
    }
}


pub fn main(){
    let mut inputs = input();
    inputs.sort_unstable();
    inputs.reverse();
    print!("{}", inputs[0]);
    for i in 1..inputs.len() {
        print!("+{}", inputs[i]);
    }
    println!("");
}

fn input() -> Vec<u32> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input);
    input.trim().split('+').map(|s| s.parse::<u32>().unwrap())
        .collect()
}


fn main() {
let mut ques = String::new();
    std::io::stdin()
            .read_line(&mut ques)
            .expect("Values not found");

let ques = ques.replace( "\n", "" );
let ques = ques.replace("+", " ");
let mut ques_each: Vec<usize> = ques.split_whitespace()
                                .map(|s| s.parse()
                                            .expect("value not found"))
                                .collect();
    // ques_each.sort();
// println!("{:?}", ques_each);
    sort(ques_each.as_mut_slice());
    println!("{:?}", ques_each);

    let mut first = true;
    for i in ques_each {
        if !first {
            print!("+");
        }
        print!("{}",i);
        first = false;
    }
    println!("");

// let in1 = ques_each[0];
// let in2 = ques_each[1];
// let in3 = ques_each[2];
    // let test1 = in1 + in2;
// println!("{}+{}+{} ", in1, in2, in3);
}

fn sort(vec: &mut [usize]) {
    // let (mut i, mut j, mut small, mut temp): (usize, usize, usize, usize) = (0, 0, 0, 0);

    for i in 0..vec.len() - 1 {
        let mut small = i;
            for j in (i+1)..vec.len() {
                if vec[j] < vec[small] {
                    small = j;
                }
            }
            let temp = vec[i];
            vec[i] = vec[small];
            vec[small] = temp;
    }
}


#![allow(unused_imports, unused_variables, dead_code, non_snake_case, unused_macros)]
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;
fn getline() -> String {
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}
macro_rules ! readl { ( $ t : ty ) => { { let s = getline ( ) ; s . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,+ ) => { { let s = getline ( ) ; let mut iter = s . trim ( ) . split ( ' ' ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; }
macro_rules ! readlvec { ( $ t : ty ) => { { let s = getline ( ) ; let iter = s . trim ( ) . split ( ' ' ) ; iter . map ( | x | x . parse ( ) . unwrap ( ) ) . collect ::< Vec <$ t >> ( ) } } }
macro_rules ! mvec { ( $ v : expr , $ s : expr ) => { vec ! [ $ v ; $ s ] } ; ( $ v : expr , $ s : expr , $ ( $ t : expr ) ,* ) => { vec ! [ mvec ! ( $ v , $ ( $ t ) ,* ) ; $ s ] } ; }
macro_rules ! debug { ( $ x : expr ) => { println ! ( "{}: {:?}" , stringify ! ( $ x ) , $ x ) } }
fn printiter<'a, T>(v: &'a T)
where
    &'a T: std::iter::IntoIterator,
    <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display,
{
    for (i, e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}
struct ContestPrinter {
    s: String,
}
impl ContestPrinter {
    fn new() -> ContestPrinter {
        ContestPrinter { s: String::new() }
    }
    fn print<T>(&mut self, x: T)
    where
        T: std::fmt::Display,
    {
        self.s.push_str(format!("{}", x).as_str());
    }
    fn println<T>(&mut self, x: T)
    where
        T: std::fmt::Display,
    {
        self.s.push_str(format!("{}\n", x).as_str());
    }
}
impl std::ops::Drop for ContestPrinter {
    fn drop(&mut self) {
        print!("{}", self.s);
    }
}
static MOD: i64 = 1e9 as i64 + 7;
fn is_max_i64(num: i64) -> bool {
    if num == i64::max_value() {
        true
    } else {
        false
    }
}
fn main() {
    let mut pr = ContestPrinter::new();
    let N = readl!(usize);
    let s = readl!(String);
    let sc = s.chars().collect::<Vec<char>>();
    let mut idx = 1;
    let mut ans = 1;
    if N == 1 {
        pr.println(1);
        return;
    }
    while idx < N {
        if ((sc[idx - 1] == 'R') & (sc[idx] == 'U')) |
           ((sc[idx - 1] == 'U') & (sc[idx] == 'R')) {
            idx += 1;
        }
        ans += 1;
        idx += 1;
    }
    pr.println(ans);
}


use std::io;

fn read_int_line () -> i32 {
    let mut num = String::new();
    io::stdin().read_line(&mut num)
        .expect("Failed to read line");

    num.trim().parse()
        .expect("Not an integer")
}

fn main() {

	read_int_line();

	let mut string = String::new();
	io::stdin().read_line(&mut string)
		.expect("Failed to read line");

	let v: Vec<&str> = string.split(char::is_uppercase).collect();
	let mut maximum: i32 = 0;

	for s in v {
		let mut vi: Vec<char> = s.trim().chars().collect();
		vi.dedup();
		let temp: i32 = vi.len() as i32;
		if maximum < temp {
			maximum = temp;
		}
	}
	println!("{}", maximum);
}


use std::collections::HashMap;
use std::io::stdin;
fn main() {
    let mut text = String::new();
    stdin().read_line(&mut text).unwrap();
    text.clear();
    stdin().read_line(&mut text).unwrap();
    let text = text.trim();
    println!("{}", find_distinct_lc(text))
}

fn find_distinct_lc(text: &str) -> u8 {
    let mut hash: HashMap<char, bool> = HashMap::new();
    let mut counter = 0;
    for i in text.chars() {
        match i {
            'a'..='z' => match hash.get(&i) {
                Some(_) => (),
                _ => {
                    hash.insert(i, true);
                    counter += 1;
                    ()
                }
            },
            _ => (),
        };
    }
    counter
}


use std::io;

fn can_eat_row(r: &Vec<bool>) -> bool {
  for i in 0..r.len() {
    if !r[i] { return false }
  }
  true
}

fn can_eat_col(m: &Vec<Vec<bool>>, j: usize) -> bool {
  for r in m {
    if !r[j] { return false }
  }
  true
}

fn main() {
  let mut s = String::new();
  io::stdin().read_line(&mut s).unwrap();
  let a: Vec<i32> = s.split_whitespace()
    .map(|x| x.parse().unwrap())
    .collect();

  let r = a[0];
  let c = a[1];

  let mut v: Vec<Vec<bool>> = vec![];

  for _ in 0..r {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    v.push(s.trim().chars()
      .map(|x| x == '.')
      .collect()
    );
  }

  let mut eatable_rows = vec![];
  for i in 0..r as usize {
    if can_eat_row(&v[i]) { eatable_rows.push(i); }
  }

  let mut eatable_cols = vec![];
  for j in 0..c as usize {
    if can_eat_col(&v, j) { eatable_cols.push(j); }
  }

  let er = eatable_rows.len() as i32;
  let ec = eatable_cols.len() as i32;

  if er == 0 || ec == 0 {
    println!("0");
    return;
  }

  println!("{}", er*c + ec*(r-er));
}


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

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

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

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

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

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    dp[0] = ModInt::new(0);
    let mut e = vec![ModInt::new(0); N + 1];
    let mut o = vec![ModInt::new(0); N + 1];
    for i in 0..N {
        if i % 2 == 0 {
            dp[i] = dp[i] + o[i];
            e[i + 1] = e[i] + dp[i];
            o[i + 1] = o[i];
        } else {
            dp[i] = dp[i] + e[i];
            o[i + 1] = o[i] + dp[i];
            e[i + 1] = e[i];
        }
    }

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


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

use std::fmt::Debug;
use std::str::FromStr;

fn read_stdin() -> String {
    let mut s = String::new();
    std::io::stdin()
        .read_line(&mut s)
        .expect("cannot read stdin");
    s.trim().to_string()
}

fn read<T>() -> T
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    read_stdin().parse::<T>().unwrap()
}

fn read_usize() -> usize {
    read::<usize>()
}

fn read_2<A, B>() -> (A, B)
where
    A: FromStr,
    <A as FromStr>::Err: Debug,
    B: FromStr,
    <B as FromStr>::Err: Debug,
{
    let s = read_stdin();
    let mut s = s.split_whitespace();
    let a = s.next().unwrap().parse::<A>().unwrap();
    let b = s.next().unwrap().parse::<B>().unwrap();
    (a, b)
}

fn read_3<A, B, C>() -> (A, B, C)
where
    A: FromStr,
    <A as FromStr>::Err: Debug,
    B: FromStr,
    <B as FromStr>::Err: Debug,
    C: FromStr,
    <C as FromStr>::Err: Debug,
{
    let s = read_stdin();
    let mut s = s.split_whitespace();
    let a = s.next().unwrap().parse::<A>().unwrap();
    let b = s.next().unwrap().parse::<B>().unwrap();
    let c = s.next().unwrap().parse::<C>().unwrap();
    (a, b, c)
}

fn read_4<A, B, C, D>() -> (A, B, C, D)
where
    A: FromStr,
    <A as FromStr>::Err: Debug,
    B: FromStr,
    <B as FromStr>::Err: Debug,
    C: FromStr,
    <C as FromStr>::Err: Debug,
    D: FromStr,
    <D as FromStr>::Err: Debug,
{
    let s = read_stdin();
    let mut s = s.split_whitespace();
    let a = s.next().unwrap().parse::<A>().unwrap();
    let b = s.next().unwrap().parse::<B>().unwrap();
    let c = s.next().unwrap().parse::<C>().unwrap();
    let d = s.next().unwrap().parse::<D>().unwrap();
    (a, b, c, d)
}

fn read_multiple<T: FromStr>() -> Vec<T>
where
    <T as FromStr>::Err: Debug,
{
    read_stdin()
        .split_whitespace()
        .map(|x| x.parse::<T>().expect("cannot parse stdin"))
        .collect()
}

/// NOTE: sort iter beforehand if required
fn count<T>(iter: &mut impl Iterator<Item = T>) -> Vec<(T, usize)>
where
    T: std::cmp::Ord,
{
    let iter = iter.collect::<Vec<_>>();
    //iter.sort();
    let (mut v, o, c) =
        iter.into_iter()
            .fold((Vec::new(), None, 0), |(mut v, last, count), item| {
                if let Some(o) = last {
                    if item == o {
                        (v, Some(o), count + 1)
                    } else {
                        v.push((o, count));
                        (v, Some(item), 1)
                    }
                } else {
                    (v, Some(item), 1)
                }
            });
    if let Some(i) = o {
        v.push((i, c));
    }
    v
}

fn partial_sum<T>(v: impl Iterator<Item = T>) -> impl Iterator<Item = T>
where
    T: Default + std::ops::Add<Output = T> + Copy,
{
    v.scan(T::default(), |state, x| {
        *state = *state + x;
        Some(*state)
    })
}

fn partial_max<T>(v: impl Iterator<Item = T>) -> impl Iterator<Item = T>
where
    T: Default + Ord + Copy,
{
    v.scan(T::default(), |state, x| {
        *state = max(*state, x);
        Some(*state)
    })
}

fn partial_min(v: impl Iterator<Item = u64>) -> impl Iterator<Item = u64> {
    v.scan(std::u64::MAX, |state, x| {
        *state = min(*state, x);
        Some(*state)
    })
}

fn max_subarray(v: impl Iterator<Item = i64>) -> (i64, (usize, usize)) {
    //assert!(v.len() > 0);
    let mut best_sum = 0;
    let (mut best_start, mut best_end) = (0, 0);
    let mut current_sum = 0;
    let mut current_start = 0;
    for (end, val) in v.enumerate() {
        if current_sum <= 0 {
            current_start = end;
            current_sum = val;
        } else {
            current_sum += val;
        }
        if current_sum > best_sum {
            best_sum = current_sum;
            best_start = current_start;
            best_end = end + 1;
        }
    }
    (best_sum, (best_start, best_end))
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    while a != 0 {
        let old_m = a;
        a = b % a;
        b = old_m;
    }
    b
}

/// returns gcd, and pair (x, y), such that x * a + b * y == gcd
fn egcd(a: i64, b: i64) -> (i64, i64, i64) {
    if a == 0 {
        (b, 0, 1)
    } else {
        let (g, x, y) = egcd(b % a, a);
        (g, y - (b / a) * x, x)
    }
}

fn factorize(mut n: u64) -> Vec<u64> {
    if n <= 3 {
        return vec![n];
    }
    let mut v = Vec::new();
    while n % 2 == 0 {
        n /= 2;
        v.push(2);
    }
    while n % 3 == 0 {
        n /= 3;
        v.push(3);
    }
    let mut f = 6;
    while (f - 1) * (f - 1) <= n {
        while n % (f - 1) == 0 {
            n /= f - 1;
            v.push(f - 1);
        }
        while n % (f + 1) == 0 {
            n /= f + 1;
            v.push(f + 1);
        }
        f += 6;
    }
    if n > 1 {
        v.push(n);
    }
    v
}

fn compact_factors(n: u64) -> Vec<(u64, usize)> {
    count(&mut factorize(n).into_iter())
}

fn all_factors(n: u64) -> Vec<u64> {
    if n == 0 {
        return vec![0];
    } else if n == 1 {
        return vec![1];
    }
    let factors = compact_factors(n);
    let mut v = vec![1];
    for (fac, num) in factors {
        let ori = v.clone();
        for i in 1..num + 1 {
            v.append(
                &mut ori
                    .clone()
                    .into_iter()
                    .map(|f| f * fac.pow(i as u32))
                    .collect::<Vec<_>>(),
            )
        }
    }
    v.sort();
    v
}

fn abs_diff<T>(a: T, b: T) -> T
where
    T: PartialOrd + std::ops::Sub<Output = T>,
{
    if a > b {
        a - b
    } else {
        b - a
    }
}

struct Permutations<T> {
    inner: Vec<T>,
    state: Vec<usize>,
    i: usize,
    start: bool,
}

impl<T> Permutations<T> {
    fn new(inner: Vec<T>) -> Self {
        Self {
            state: vec![0; inner.len()],
            i: 0,
            start: true,
            inner,
        }
    }
}

/*impl<T, X> From<X> for Permutations<T>
where
    X: IntoIterator<Item = T>,
{
    fn from(f: X) -> Self {
        Self::new(f.into_iter().collect::<Vec<T>>())
    }
}*/

impl<T> Iterator for Permutations<T>
where
    T: Clone,
{
    type Item = Vec<T>;
    fn next(&mut self) -> Option<Self::Item> {
        if self.start {
            self.start = false;
            return Some(self.inner.clone());
        }
        while self.i < self.inner.len() {
            if self.state[self.i] < self.i {
                if self.i % 2 == 0 {
                    self.inner.swap(0, self.i)
                } else {
                    self.inner.swap(self.state[self.i], self.i)
                }
                self.state[self.i] += 1;
                self.i = 0;
                return Some(self.inner.clone());
            } else {
                self.state[self.i] = 0;
                self.i += 1;
            }
        }
        None
    }
}

use std::cmp::{max, min, Ord, Ordering};
use std::collections::{BinaryHeap, VecDeque};
use std::mem::swap;

macro_rules! max_with {
    ($x: expr, $y: expr) => {
        $x = max($x, $y)
    };
}

macro_rules! min_with {
    ($x: expr, $y: expr) => {
        $x = max($x, $y)
    };
}

fn is_prime(n: u64) -> bool {
    factorize(n).len() == 1
}

fn combination(n: u64, k: u64, m: u64) -> u64 {
    if n == 0 {
        return 1;
    }
    if k == 0 || k == n {
        return 1;
    }
    let new_k = if n - k < k { n - k } else { k };
    let mut res = 1;
    for i in ((n - new_k) + 1)..=n {
        res *= i;
        res %= m;
    }
    let mut den = 1;
    for i in 1..=(new_k) {
        den *= i;
        den %= m;
    }
    let (_one, inverse, _c) = egcd(den as i64, m as i64);
    let inverse = if inverse < 0 {
        m as i64 + inverse
    } else {
        inverse
    } as u64;
    //println!("inv: {} {}", den, inverse);
    res *= inverse;
    res %= m;
    res
}

use std::collections::HashSet;
use std::iter::FromIterator;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let modulo = 998244353;
    let n = read_usize();
    let mut state = vec![0; n + 1];
    state[0] = 1;
    state[1] = 1;
    state[2] = 1;
    let mut denom = 4;
    for i in 3..=n {
        /*for j in (0..i).rev().step_by(2) {
            state[i] += state[j];
        }*/
        state[i] = state[i - 1] + state[i - 2];
        //println!("{:?}", state);
        state[i] %= modulo;
        denom *= 2;
        denom %= modulo;
        //let (g, _denom_inv, _y) = egcd(denom, state[i]);
        //println!("{} {}", state[i] / g, denom / g);
    }
    //println!("{} {}", state[n], denom);
    if n == 1 {
        denom = 2;
    }
    let (_g, mut denom_inv, _y) = egcd(denom, modulo);
    if denom_inv < 0 {
        denom_inv += modulo;
    }
    println!("{}", (state[n] * denom_inv) % modulo);

    Ok(())
}


// vim: foldmethod=marker
// vim: foldmarker={{{,}}}

#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::io::Write;

// {{{
#[allow(unused_macros)]
macro_rules! read_non_empty_line {
    () => {{
        let mut inner = String::new();
        while true {
            io::stdin().read_line(&mut inner).unwrap();
            if inner.trim() != "" {
                break;
            }
            inner.clear();
        }
        inner
            .trim_end_matches(|c| c == '\r' || c == '\n')
            .to_string()
    }};
}

#[allow(unused_macros)]
macro_rules! read_multi {
    ($($t: ty),+) => ({
        let line = read_non_empty_line!();
        let mut i = line.trim().split_whitespace();
        (
            $(
            i.next().unwrap().parse::<$t>().unwrap(),
            )+
        )
    })
}

#[allow(unused_macros)]
macro_rules! read {
    () => {
        read_non_empty_line!().trim().parse::<_>().unwrap()
    };
}

#[allow(unused_macros)]
macro_rules! read_vec {
    () => {
        read_non_empty_line!()
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<_>().unwrap())
            .collect::<Vec<_>>();
    };
}

#[allow(unused_macros)]
macro_rules! fmt_vec {
    ($v:ident) => {
        $v.iter()
            .map(|v| format!("{}", v))
            .collect::<Vec<_>>()
            .join(" ")
    };
}

// }}}

static MOD: i64 = 998244353;

fn pow(n: i64, x: i64) -> i64 {
    if x == 0 {
        return 1;
    }
    if n == 1 {
        return 1;
    }
    let h = pow(n, x / 2);
    let mut v = (h * h) % MOD;
    if x % 2 == 1 {
        v = (v * n) % MOD;
    }
    v
}

fn inv(x: i64) -> i64 {
    pow(x, MOD - 2)
}

fn solve(writer: &mut io::BufWriter<io::Stdout>) {
    let n: usize = read!();
    let mut r: Vec<i64> = vec![0; n + 1 as usize];

    r[0] = 1;
    r[1] = 1;
    r[2] = 1;
    for i in 3..n + 1 {
        r[i] = (r[i - 1] + r[i - 2]) % MOD;
    }
    writeln!(writer, "{}", (r[n] * inv(pow(2, n as i64))) % MOD).unwrap();
}

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


/*
    date   : 2020 / 5 / 5
    author : quickn (quickn.ga)
    email  : quickwshell@gmail.com
*/

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

mod scanner {
    use std::{io, str};
    /* https://github.com/EbTech/rust-algorithms */

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

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

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

const MOD: i64 = 998244353;

fn pow_mod(a: i64, x: i64) -> i64 {
    let (mut r, mut a_t, mut x_t) = (1, a, x);
    while x_t != 0 {
        if (x_t & 1) == 1 {
            r *= a_t;
            r %= MOD;
        }
        a_t *= a_t;
        a_t %= MOD;
        x_t >>= 1;
    }
    r
}

fn mod_inv(a: i64) -> i64 {
    pow_mod(a, MOD-2)
}

fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let (mut scan, mut sout) = (
        scanner::UnsafeScanner::new(stdin.lock()),
        BufWriter::new(stdout.lock()),
    );
    let n: i64 = scan.token();
    let mut dp: Vec<i64> = vec![0;(n+1) as usize];
    let mut inv2 = mod_inv(2);
    dp[0] = 1;
    dp[1] = inv2;
    dp[2] = (dp[1]*inv2)%MOD;
    for i in 3..=(n as usize) {
        dp[i] = (((dp[i-1]*inv2)%MOD) + ((dp[i-2]*pow_mod(inv2, 2))%MOD))%MOD;
    }
    writeln!(sout, "{}", dp[n as usize]).ok();
}


// 2018-10-14 22:34
fn main() {
    let v1: Vec<i32> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim()
            .split(" ")
            .map(|s| s.parse::<i32>().unwrap())
            .collect()
    };
    let v2: Vec<i32> = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim()
            .split(" ")
            .map(|s| s.parse::<i32>().unwrap())
            .collect()
    };
    let n: i32 = {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };

    let n1 = (v1.iter().sum::<i32>() as f32 / 5.0).ceil() as i32;
    let n2 = (v2.iter().sum::<i32>() as f32 / 5.0).ceil() as i32;
    println!("{}", if n1 + n1 <= n { "YES" } else { "NO" });
}


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

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

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

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

}
fn _main() {
    let mut scan = Scan::new();
    let sum1: usize = scan.next_n(3).iter().sum();
    let sum2: usize = scan.next_n(3).iter().sum();
    let minsum = sum1.min(sum2);
    let n: usize = scan.next();
    let valid = sum1+sum2 == 0 || n>=2 || minsum==0 && n==1;
    println!("{}", if valid {"YES"} else {"NO"});
}

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


use std::io::stdin;

fn main() {
    let mut arr: [i16; 101] = [0; 101];
    let mut inp = String::with_capacity(300);
    for _ in 1..3 {
        stdin().read_line(&mut inp).unwrap();
    }
    let mut i: usize;
    for num in inp.split_whitespace() {
        i = num.parse().unwrap();
        arr[i] += 1;
    }
    let mut max = arr[0];
    i = 1;
    while i < arr.len() {
        if arr[i] > max {
            max = arr[i];
        }
        i += 1;
    }
    println!("{}",max);
}


use std::io;

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

    io::stdin().read_line(&mut kbd).expect("WHY!");

    let kbd:u32 = kbd.trim().parse().expect("WHY!");

    if kbd > 0 {
        println!("25");
    }
}


use std::io;

fn read_integer_line() -> u32 {
    let mut n = String::new();
    io::stdin()
        .read_line(&mut n)
        .expect("failed to read input.");
    let n: u32 = n.trim().parse().expect("invalid input");
    n
}

fn modpow(base: u32, expo: u32, modulo: u32) -> u32 {
    if expo == 0 {
        return 1;
    }
    let partial = modpow(base, expo / 2, modulo);
    let ans = (partial * partial) % modulo;
    if expo % 2 == 0 {
        ans
    }
    else {
        (ans * base) % modulo
    }
}

fn main() {
    let n = read_integer_line();
    let ans = modpow(5, n, 100);
    println!("{}", ans);
}


/*
    Geometry, math - https://codeforces.com/problemset/problem/1369/A
    Completed: 4/7/20 14:06
*/

use std::io;

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

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

    // This is so retarded
    if input > 55 {
        println!("25");
    }

    let power: u128 = 5_u128.pow(input);
    let power_to_string = power.to_string();
    let mut power_to_string_len = power_to_string.len();

    let mut output = String::from("");

    for char in power_to_string.chars() {
        if power_to_string_len != 2 {
            power_to_string_len -= 1;
        } else {
            output.push(char);
        }
    }

    println!("{}", output);

}


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

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

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

fn main() {
    let n = readln!(i32);
    if n < 10 {
        println!("{}",(0..n).fold(1,|x,_|(x*5)%100));
    } else {
        let mut a : Vec<i32> = Vec::new();
        a.push(1);
        let mut start : i32 = -1;
        let mut length : i32 = -1;
        let mut i = 1;
        while start < 0 {
            let z = a.len();
            let zz = (a[z-1]*5)%100;
            a.push(zz);
            for j in 0..z {
                if a[j] == a[z] {
                    start = j as i32;
                    length = ((z+1) as i32 - start) as i32;
                    break;
                }
            }
        }
        println!("{:?}",a);
        println!("{}",a[(n-start) as usize % length as usize]);
    }
}


use std::io;

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(),
            )+
        )
    }}
}

fn main() {
    let (mut x, mut y, mut z) = readln!(i32, i32, i32);
    let (mut a, mut b, mut c) = readln!(i32, i32, i32);

    let result = if a < x {
        false
    } else {
        a -= x;
        x = 0;

        if c >= z {
            c -= z;
            z = 0;

            y <= a + b + c
        } else {
            z -= c;
            c = 0;
            y + z <= a + b
        }
    };

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


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

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

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

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

fn gcd(mut a: i64, mut b: i64) -> i64 {
    while b > 0 {
        a %= b;
        let tmp = a;
        a = b;
        b = tmp;
    }
    a
}

fn lcm(a: i64, b: i64) -> i64 {
    a / gcd(a, b) * b
}

fn solution() {
    let mut scanner = Scanner::new();
    let n: i64 = scanner.next();
    let k: i64 = scanner.next();
    let a: i64 = scanner.next();
    let b: i64 = scanner.next();

    let mut x = std::i64::MAX;
    let mut y = 0;
    for s in [-a, a].iter() {
        for i in 0..n {
            let p = i * k;
            for s2 in [p - b, p + b].iter() {
                let mut l = s2 - s;
                if l <= 0 {
                    l += n * k;
                }
                let m = lcm(l, n * k);
                x = std::cmp::min(x, m / l);
                y = std::cmp::max(y, m / l);
            }
        }
    }
    println!("{} {}", x, y);
}

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


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 ok(x: u64) -> bool {
    let test = x | (x - 1);
    test & (test + 1) == 0
}

fn solve() {
    let n = parse_line!(u64);
    let mut result = n - 1;
    while n % result != 0 || !ok(result) {
        result -= 1;
    }
    println!("{}", result)
}

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


use std::io;

fn main() {
    let mut s = String::new();
    let mut x = 0;

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

    for ch in s.chars() {
        if ch == '4' || ch == '7' {
            x += 1;
        }
    }

    if x == 4 || x == 7 {
        println!("YES");
    } else {
        println!("NO");
    }
}


use std::io::*;

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

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

    let inputs: String = read(sin);

    for c in inputs.as_str().chars() {
        match c {
            '4' | '7' => (),
            _ => {
                println!("NO");
                return;
            }
        }
    }

    println!("YES");
}


use std::io;

fn main() {
    let (len,num)=input();
    let mut sum=0;
    for i in 1..len+1{
        if part(num,i)==7 || part(num,i)==4{
            sum+=1
        }
    }
    let mut con=false;
    while sum>0{
        let x=sum%10;
        if x!=7 && x!=4{
            con=true;
        }sum/=10
    }if con==false{
        println!("YES");
    }else{
        println!("NO");
    }

}

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

fn input() -> (i32,i32){
    let inp=read();
    (inp.len() as i32,inp.parse::<i32>().expect("Failed to parse"))
    /*let list: Vec<_>=inp.split_whitespace().collect();
    let qu: Vec<_>=read().chars().collect();
    (list[0].parse::<i32>().expect("Failed to parse"),
    list[1].parse::<i32>().expect("Failed to parse"),qu)*/
}
fn part(n:i32,i: i32) -> i32{
    n%10_i32.pow(i as u32)/10_i32.pow((i-1) as u32)
}


use std::collections::HashSet;

fn main() {
    let set: HashSet<char> = read_line().chars().collect();
    match set.iter().find(|c| "01235689".find(**c) != None) {
        Some(_) => {println!("NO")},
        None => {println!("YES")}
    }

}

fn read_line() -> String {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Ошибка чтения");

    input.trim().to_string()
}


use std::str::FromStr;

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

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

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

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

fn main() {
    let mut minimum_capacity: u32 = 0;
    let mut current_capacity: u32 = 0;
    for _ in 0..read_int::<u32>() {
        let (a, b): (u32, u32) = read_tuple();
        current_capacity = current_capacity - a + b;
        minimum_capacity = std::cmp::max(minimum_capacity, current_capacity);
    }
    println!("{}", minimum_capacity);
}


use std::io::stdin;

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


use std::process::Command;
fn main() {
    let mut x: i32 = fetch_user_input("X: ".to_string());
    let y: i32 = fetch_user_input("Y: ".to_string());
    x = calculate_number(x, y);
    println!("{}", x);
    let _ = Command::new("cmd.exe").arg("/c").arg("pause").status();
}
fn calculate_number(mut x: i32, y: i32) -> i32 {
    for _i in 0..y {
        if x % 10 == 0 {
            x = x / 10;
        } else {
            x -= 1;
        }
    }
    x
}
fn fetch_user_input(input_text: String) -> i32 {
    println!("{}", input_text);
    use std::io::stdin;
    let mut input = String::new();
    stdin().read_line(&mut input).expect("input error");
    input.trim().parse().unwrap()
}


use std::io;

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

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

  let v: Vec<&str> = input.split(" ").collect();

  let mut num: i16 = match v[0].trim().parse() {
    Ok(i) => i,
    Err(_) => 0
  };

  let mut times: i16 = match v[1].trim().parse() {
    Ok(i) => i,
    Err(_) => 0
  };

  while times > 0 {
    let last = num % 10;

    num = match last {
      0 => num / 10,
      _ => num - 1,
    };

    times -= 1;
  };

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


use std::io;
use std::boxed::Box;

fn input() -> Result<String, Box<dyn std::error::Error>> {
    let mut ret = String::new();
    io::stdin().read_line(&mut ret)?;
    Ok(ret)
}

fn main() {
    let mut n: i32 = input().unwrap().trim().parse().unwrap();
    let k: i32 = input().unwrap().trim().parse().unwrap();

    for _ in 0..k {
        if n % 10 == 0 {
            n /= 10;
        } else {
            n -= 1;
        }
    }

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


fn main() {
    println!("4");
}

// use std::io;
// use std::boxed::Box;

// fn input() -> Result<String, Box<dyn std::error::Error>> {
//     let mut ret = String::new();
//     io::stdin().read_line(&mut ret)?;
//     Ok(ret)
// }

// fn main() {
//     let mut n: i32 = input().unwrap().trim().parse().unwrap();
//     let k: i32 = input().unwrap().trim().parse().unwrap();

//     for _ in 0..k {
//         if n % 10 == 0 {
//             n /= 10;
//         } else {
//             n -= 1;
//         }
//     }

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


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

    io::stdin().read_line(&mut i)
        .expect("Oh no N");

    let  s: Vec<&str> = i.split(" ").collect();
    let mut n: u32 = match s[0].trim().parse() {
        Ok(num) => num,
        Err(_) => panic!("Oh no"),
    };
    let k: u32 = match s[1].trim().parse() {
        Ok(num) => num,
        Err(_) => panic!("Oh no"),
    };

    for _ in 0..k {
        if n % 10 == 0 {
            n /= 10;
        } else {
            n -= k;
        }
    }
    println!("{}", n );
}


use std::io;
use std::io::prelude::*;

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

    io::stdin().read_line(&mut input).expect("fail read!");
    let words: Vec<&str> = input.split_whitespace().collect();
    let mut n: usize = words[0].trim().parse().unwrap();
    let k: usize = words[1].trim().parse().unwrap();
    println!("{}", div(n, k));
    Ok(())
}

fn div(mut n: usize, mut k: usize) -> usize {
    while k > 0 {
        let rem = n % 10;
        if rem < k {
            k = k - rem - 1;
            n = n / 10;
        } else {
            n = n - k;
            k = 0;
        }
    }
    n
}


use std::io;
use std::io::prelude::*;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut input).expect("fail read!");
    let words: Vec<&str> = input.split_whitespace().collect();
    let mut n: usize = words[0].trim().parse().unwrap();
    let k: usize = words[1].trim().parse().unwrap();

    println!("{}", div(n, k));
}

fn div(mut n: usize, mut k: usize) -> usize {
    while k > 0 {
        let rem = n % 10;
        if rem < k {
            k = k - rem - 1;
            n = n / 10;
        } else {
            n = n - k;
            k = 0;
        }
    }
    n
}

macro_rules! decl_error{
    ($($error:ident)*) => {
        #[derive(Debug)]
        pub enum Error {
            $($error($error),)*
        }

        $(
            impl From<$error> for Error {
                fn from(e: $error) -> Self {
                    Error::$error(e)
                }
            }
        )*

        pub type Result<T> = std::result::Result<T, Error>;
    }

}

mod error {
    use std::io::Error as StdError;
    use std::num::ParseIntError;
    decl_error!(StdError ParseIntError);
}

use error::Result;


use std::io;

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

    let a: Vec<u8> = {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        input.split_whitespace().map(|k| k.parse().unwrap()).collect()
    };

    let a: Vec<_> = a.into_iter().skip_while(|&k| k == 0).collect();

    let a: Vec<_> = a.into_iter().rev().skip_while(|&k| k == 1).collect();

    let ans = a.iter().filter(|&&k| k == 0).count();

    let ans = std::cmp::min(ans, a.len() - ans);

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


//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

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

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;
#[allow(unused_imports)]
use std::io::{stdout, BufWriter, Write};

fn main() {
    let (a, b, c, d): (u64, u64, u64, u64);
    input!(a, b, c, d);

    let mut ans = 0_u64;
    for y in b..=c {
        let t = std::cmp::min(d, b + y - 1);
        let f = std::cmp::min(std::cmp::max(c, a + y - 1), t);
        ans += ((t - f + 1) * (t - f + 2)) / 2;
        //dbg!(t, f, t, ((t - f + 1) * (t - f + 2)) / 2);
    }
    println!("{}", ans);
}


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 (a, b, c, d) = parse_line!(u64, u64, u64, u64);
    let mut result = 0;
    for x in a..=b {
        if c - b + 1 >= x {
            if d - c + 1 >= x {
                result += x * (x + 1) / 2;
            }else{
                let grow = d - c + 1;
                let fix = x - grow;
                result += grow * (grow + 1) / 2 + fix * grow;
            }
        }else{
            if d - c + 1 >= x {
                let min = c - b + 1;
                result += (x - min + 1 + x) * min / 2;
            }else{
                if d - b + 1 >= x {
                    let grow = d - b + 1 - x;
                    result += (d - c + 1 - grow + d - c) * grow / 2 +
                        (d - c + 1 - grow) * (d - c + 1);
                }else{
                    result += (c - b + 1) * (d - c + 1);
                }
                let min = c - b + 1;
                let grow = d - c + 1 - min;
                let fix = min - grow;
                result += grow * (grow + 1) / 2 + fix * grow;
            }
        }
    }
    writeln!(writer, "{}", result).unwrap();
}

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


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

struct DigitSequenceIterator {
    inner: usize,
    state: VecDeque<char>,
}

impl Iterator for DigitSequenceIterator {
    type Item = char;

    fn next(&mut self) -> Option<char> {
        if self.state.len() == 0 {
            self.state.extend(self.inner.to_string().chars());;

            self.inner += 1;
        }

        self.state.pop_front()
    }
}

impl DigitSequenceIterator {
    pub fn new() -> Self {
        DigitSequenceIterator {
            inner: 0,
            state: VecDeque::new(),
        }
    }

    pub fn skip(mut to_skip: usize) -> impl Iterator<Item=char> {
        let mut inner = 0;

        if to_skip >= 10 {
            inner = 10;
            to_skip -= 10;
        }

        let mut can_jump = 90;
        while to_skip > can_jump {
            to_skip -= can_jump;
            inner *= 10;

            can_jump *= 10;
        }

        DigitSequenceIterator {
            inner,
            state: VecDeque::new(),
        }.skip(to_skip)
    }
}

fn main() {
    let stdin = io::stdin();
    let line = stdin.lock().lines().next().expect("input").expect("UTF-8");
    let index: usize = line.parse().expect("Numeric value");

    println!("{}", DigitSequenceIterator::skip(index).next().unwrap());
}

#[test]
fn vectors() {
    let in_out = [(7, '7'), (21, '5'), (192, '0'), (417, '5')];

    for (i, o) in &in_out {
        let test = DigitSequenceIterator::skip(*i).next().unwrap();
        assert_eq!(test, *o,
            "{}th should be {}, but got {}", i, *o, test);
    }
}


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

struct DigitSequenceIterator {
    inner: usize,
    state: VecDeque<char>,
}

impl Iterator for DigitSequenceIterator {
    type Item = char;

    fn next(&mut self) -> Option<char> {
        if self.state.len() == 0 {
            self.state.extend(self.inner.to_string().chars());;

            self.inner += 1;
        }

        self.state.pop_front()
    }
}

impl DigitSequenceIterator {
    pub fn new() -> Self {
        DigitSequenceIterator {
            inner: 0,
            state: VecDeque::new(),
        }
    }

    pub fn skip(mut to_skip: usize) -> impl Iterator<Item=char> {
        let mut inner = 0;

        if to_skip >= 10 {
            inner = 10;
            to_skip -= 10;
        }

        let mut can_jump = 90;
        let mut i = 2;
        while to_skip > can_jump * i {
            to_skip -= can_jump * i;
            inner *= 10;

            can_jump *= 10;
            i += 1;
        }

        DigitSequenceIterator {
            inner,
            state: VecDeque::new(),
        }.skip(to_skip)
    }
}

fn main() {
    let stdin = io::stdin();
    let line = stdin.lock().lines().next().expect("input").expect("UTF-8");
    let index: usize = line.parse().expect("Numeric value");

    println!("{}", DigitSequenceIterator::skip(index).next().unwrap());
}

#[test]
fn vectors() {
    let in_out = [(7, '7'), (21, '5'), (188, '9'), (192, '0'), (417, '5')];

    for (i, o) in &in_out {
        let test = DigitSequenceIterator::skip(*i).next().unwrap();
        assert_eq!(test, *o,
            "{}th should be {}, but got {}", i, *o, test);
    }
}


type Res = u64;

fn main() {
    let k = {
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        input.trim().parse::<Res>().unwrap()
    };

    // counter for digits
    let mut n: Res = 0;
    // Potential number of the digit we search
    let mut d: Res = 1;
    while n<k {
        d += 1;
        n += int_len(d);
    }
    d -= 1;
    let idx = (n-k) as usize;
    // At tis point we know our digit d and the index of the number we search for.

    let d_str = format!("{}", d);
    let result = d_str.chars().nth(idx).unwrap();
    println!("{}", result);

}

fn int_len(inp: Res) -> Res {
    let mut res = 0;
    let mut temp = 1;
    while temp <= inp {
        res += 1;
        temp *= 10
    }
    res
}


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

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

    let n = input.i();
    input.sk(1);
    if input.bs()[0] == b'm' {
        println!("{}", if n <= 29 {12} else if n <= 30 {11} else {8});
    } else {
        println!("{}", if n == 5 || n == 6 {53} else {52});
    }
}


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

fn exec() {
    let mut sc = Scanner::new();
    let n: usize = sc.ne();
    let _: String = sc.ne();
    let hoge: String = sc.ne();
    if hoge == "week" {
        let ans = match n {
            val if val <= 2 => 53,
            _ => 52,
        };
        println!("{}", ans);
    } else {
        let ans = match n {
            val if val <= 29 => 12,
            val if val == 30 => 11,
            _ => 7,
        };
        println!("{}", ans);
    }
}

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

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

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


use std::io::stdin;
use std::collections::HashSet;

macro_rules! readln {
        () => {{ let mut line = String::new(); stdin().read_line(&mut line).unwrap(); line }};
        ($type:ty) => {{ readln!().split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
        (|$type_vec:ty|) => {{ readln!().split_whitespace().map(|it| it.parse().unwrap()).collect::<Vec<$type_vec>>() }};
        ($($type:ty),*) => {{ let line = readln!(); let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
        ($($type:ty),*, |$type_vec:ty|) => {{ let line = readln!(); let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse().unwrap()).collect::<Vec<$type_vec>>(),)}};
}

fn division(mut n: u64) -> HashSet<u64> {
    let mut res = HashSet::new();

    if n % 2 == 0 {
        res.insert(2);
        res.insert(n / 2);
    }
    let mut i = 3;
    while i * i <= n {
        if n % i == 0 {
            res.push(i);
        }
        i += 2;
    }
    res
}

fn main() {
    let n = readln!(u64);
    let divisions = division(n);

    if divisions.is_empty() {
        println!("{}", n);
    } else if divisions.len() == 1 {
        println!("{}", divisions[0])
    } else {
        println!("1")
    }
}


use std::io::stdin;
use std::collections::HashSet;

macro_rules! readln {
        () => {{ let mut line = String::new(); stdin().read_line(&mut line).unwrap(); line }};
        ($type:ty) => {{ readln!().split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
        (|$type_vec:ty|) => {{ readln!().split_whitespace().map(|it| it.parse().unwrap()).collect::<Vec<$type_vec>>() }};
        ($($type:ty),*) => {{ let line = readln!(); let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
        ($($type:ty),*, |$type_vec:ty|) => {{ let line = readln!(); let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse().unwrap()).collect::<Vec<$type_vec>>(),)}};
}

fn main() {
    let mut n = readln!(u64);

    let mut res = HashSet::new();

    let copy = n;
    let mut i = 2;
    while n != 1 && i * i <= copy {
        if n % i == 0 {
            n /= i;
            res.insert(i);
            res.insert(copy / i);
            if res.len() == 2 {
                break;
            }
        } else {
            i += 1;
        }
    }
    res.remove(&1);

    if res.is_empty() {
        println!("{}", n);
    } else if res.len() == 1 {
        println!("{}", res.iter().next().unwrap());
    } else {
        println!("1")
    }
}


use std::io::stdin;
use std::collections::HashSet;

macro_rules! readln {
        () => {{ let mut line = String::new(); stdin().read_line(&mut line).unwrap(); line }};
        ($type:ty) => {{ readln!().split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
        (|$type_vec:ty|) => {{ readln!().split_whitespace().map(|it| it.parse().unwrap()).collect::<Vec<$type_vec>>() }};
        ($($type:ty),*) => {{ let line = readln!(); let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
        ($($type:ty),*, |$type_vec:ty|) => {{ let line = readln!(); let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse().unwrap()).collect::<Vec<$type_vec>>(),)}};
}

fn division(mut n: u64) -> HashSet<u64> {
    let mut res = HashSet::new();

    let mut i = 2;
    while n != 1 {
        if n % i == 0 {
            n /= i;
            res.insert(i);
        } else {
            i += 1;
        }
    }
    res.remove(&1);
    res
}

fn main() {
    let n = readln!(u64);
    let divisions = division(n);

    if divisions.is_empty() {
        println!("{}", n);
    } else if divisions.len() == 1 {
        println!("{}", divisions.iter().next().unwrap());
    } else {
        println!("1")
    }
}