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

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

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

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

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

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

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

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

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

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

use std::io::*;
use std::str::FromStr;
use std::char::*;
macro_rules! debug {($($a:expr),*) => {eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}

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

use std::f64;

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

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

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

struct Graph {
    e: Vec<Vec<usize>>,
    v: Vec<usize>,
    u: Vec<usize>,
    f: Vec<bool>,
    c: i64,
    flag: bool,
    vc: Vec<i64>,
}

impl Graph {
    fn new(n:usize) -> Self {
        Graph {
            e: vec![vec![];n],
            v: vec![],
            u: vec![n;n],
            f: vec![false;n],
            c: 0,
            flag: true,
            vc: vec![0;n],
        }
    }

    fn dfs(&mut self, crt: usize) {
        self.f[crt] = true;
        self.c = self.e[crt].len() as i64;
        if self.c != 2 {
            self.flag = false;
        }

        for i in 0..self.e[crt].len() {
            let v = self.e[crt][i];
            if self.f[v] { continue; }
            self.dfs(v);
        }
    }
}

fn binary_search(a: &Vec<i64>) -> usize {
    let mut left = -1;
    let mut right = a.len() as i64;

    while right - left > 1 {
        let mid:usize = ((right+left)/2) as usize;
        //debug!(left,mid,right);
        if is_ok(mid) { right = mid as i64; }
        else { left = mid as i64; }
    }
    right as usize
}

fn is_ok(key: usize) -> bool {
    true
}

fn neighbors(tree: &BTreeSet<usize>, val: usize) -> (Option<&usize>, Option<&usize>) {
    use std::ops::Bound::*;

    let mut before = tree.range((Unbounded, Excluded(val)));
    let mut after = tree.range((Excluded(val), Unbounded));

    (before.next_back(), after.next())
}

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

const MAX_A:i64 = 1e16 as i64;

fn gcd(a:i64, b:i64) -> i64 {
    if b==0 {return a;}
    gcd(b, a%b)
}

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

    input! {
        n: usize,
        a: [i64;n]
    }

    let mut ans = 0;
    let i = 0;
    if (a[i]==1 && a[i+1]==2) || (a[i]==2 && a[i+1]==1) {
        ans += 3;
    }
    else if (a[i]==1 && a[i+1]==3) || (a[i]==3 && a[i+1]==1) {
        ans += 4;
    }
    else {
        puts!("Infinite\n");
        return;
    }

    for i in 1..n-1 {
        if a[i]==1 && a[i+1]==2 {
            if a[i-1]==3 { ans += 2; }
            else { ans += 3; }
        }
        else if a[i]==2 && a[i+1]==1 {
            ans += 3;
        }
        else if a[i]==1 && a[i+1]==3 {
            ans += 4;
        }
        else if a[i]==3 && a[i+1]==1 {
            ans += 4;
        }
        else {
            puts!("Infinite\n");
            return;
        }
    }
    puts!("Finite\n");
    puts!("{}\n", ans);

}

/*

*/


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

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        a: [i32; n],
    }
    let mut cnt = 0;
    for i in 0..n - 1 {
        if a[i] + a[i + 1] == 5 {
            puts!("Infinite\n");
            return;
        }
        cnt += a[i] + a[i + 1];
    }
    for i in 0..n - 2 {
        if a[i..i + 3] == [3, 1, 2] {
            cnt -= 1;
        }
    }
    puts!("Finite\n{}\n", cnt);
}

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


use std::io;
use std::cmp::max;

trait Substring {
    fn substring(&self, start: i32, len: i32) -> String;
}

impl Substring for String {

    fn substring(&self, start: i32, len: i32) -> String {
        self.chars().skip(start as usize).take(len as usize).collect()
    }
}

fn main() {

    let mut n: String = String::new();
    let mut inp: String = String::new();

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

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

    let mut ans: Vec<_> = (0..n/2+1).filter(|&i: &i32| -> bool {
        inp.substring(0, i) == inp.substring(i, i)
    }).collect();

    let ans: i32 = ans.pop().unwrap();
    let display: i32 = n - max(ans-1, 0);

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


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

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

    let input_split: Vec<&str> = input.split_whitespace().collect();
    let twos: i64 = input_split[0].parse().expect("Failed to parse num.");
    let threes: i64 = input_split[1].parse().expect("Failed to parse num.");
    let fives: i64 = input_split[2].parse().expect("Failed to parse num.");
    let sixes: i64 = input_split[3].parse().expect("Failed to parse num.");

    let tfsx = cmp::min(cmp::min(twos, fives), sixes);
    let tts = cmp::min(threes, twos - tfsx);
    println!("{}", (tfsx * 256) + (tts * 32));
}


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

fn main() {
    let stdin = io::stdin();
    let mut c = [0; 4];
    let mut count = 0;
    for line in stdin.lock().lines() {
        c[count] = line.unwrap().parse().unwrap();
        count += 1;
    }
    if c[0] != c[3] {
        println!("0");
    } else if c[2] > 0 && c[0] == 0 {
        println!("0");
    } else {
        println!("1");
    }
}


#[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::prelude::BufRead;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    let a = read::<u64>();
    let b = read::<u64>();
    let c = read::<u64>();
    let d = read::<u64>();

    if (c == 0 || (c > 0 && a > 0 && d > 0)) && (2 * a + c) == (2 * d + c) {
        println!("1");
    } else {
        println!("0");
    }
}

#[allow(dead_code)]
fn read<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf.trim().parse().unwrap();
}

#[allow(dead_code)]
fn read_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::with_capacity(100);
    stdin().read_line(&mut buf).unwrap();
    return buf.split_whitespace().map(|s| s.parse().unwrap()).collect();
}

#[allow(dead_code)]
fn read_matrix<T>() -> Vec<Vec<T>>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    use std::io::prelude::*;
    let stdin = stdin();
    let mut reader = BufReader::with_capacity(100 * 1024, stdin);
    let mut line = String::with_capacity(100);
    let mut matrix: Vec<Vec<T>> = Vec::new();

    while reader.read_line(&mut line).unwrap() > 0 {
        matrix.push(
            line.trim()
                .split_whitespace()
                .map(|s| s.parse().unwrap())
                .collect(),
        );
        line.clear();
    }

    return matrix;
}

#[allow(dead_code)]
fn read_chars() -> Vec<char> {
    let stdin = stdin();
    let mut buf = String::new();
    let _bytes = stdin.read_line(&mut buf).unwrap();
    return buf.trim().chars().collect();
}


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

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

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

fn _main() {
    let mut scan = Scan::new();
    let mut res = 0usize;
    let n: usize = scan.next();
    let m: usize = scan.next();
    let limit: usize = n.max(m);
    for i in 0..=limit {
        for j in 0..=limit {
            if i * i + j == n && i + j * j == m {
                res += 1;
            }
        }
    }
    println!("{}", res);
}

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


//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 {
    ($i:ident . $e:tt : $t:ty; $($a:ident),*) => {
        $( let $a: $t = $i.$e(); )*
    };
    ($i:ident . $e:tt; $($a:ident),*) => {
        $( let $a = $i.$e(); )*
    };
}
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

#[allow(dead_code)]
fn build_counting_hashmap<K: Eq + std::hash::Hash, T>(i: T) -> HashMap<K,usize>
    where T: Iterator<Item = K> {
    let mut m = HashMap::new();
    for k in i {
        let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };
        m.insert(k, n);
    }
    m
}

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

    let n = input.u();
    let a = input.vi(n);
    let mut m = build_counting_hashmap(a.clone().into_iter());
    writeln!(bout, "{}", m.len()).ok();
    for x in a {
        let y = m.get_mut(&x).unwrap();
        *y -= 1;
        if *y == 0 {
            write!(bout, "{} ", x).ok();
        }
    }
}


//spnauti-rust
use std::io::*;
use std::str::*;
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::*;
#[allow(unused_imports)] use std::collections::*;

#[allow(unused_macros)]
macro_rules! a {
    ($c: tt, $x: expr, $y: expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
struct WordReader<'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 u(&mut self) ->  usize { self.p()                }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}

#[allow(dead_code)]
fn build_counting_hashmap<K: Eq + std::hash::Hash, T>(i: T) -> HashMap<K,usize>
    where T: Iterator<Item = K> {
    let mut m = HashMap::new();
    for k in i {
        let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };
        m.insert(k, n);
    }
    m
}

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

    let a = input.i();
    let b = input.i();
    let mut x = [0; 3];
    for i in 1..7 {
        x[match (a-i).abs().cmp(&(b-i).abs()) {
            Less => 0,
            Equal => 1,
            _ => 2
        }] += 1;
    }
    println!("{} {} {}", x[0], x[1], x[2]);
}


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

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

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

fn _main() {
    let mut scan = Scan::new();
    let a: usize = scan.next();
    let b: usize = scan.next();
    if a == b {
        println!("0 6 0");
    } else if a < b {
        let middle = a.max(b) - a.min(b) - 1;
        println!(
            "{} {} {}",
            a + middle / 2,
            middle % 2,
            6 - b + 1 + middle / 2
        );
    } else {
        let middle = a.max(b) - a.min(b) - 1;
        println!(
            "{} {} {}",
            6 - a + 1 + middle / 2,
            middle % 2,
            b + middle / 2
        );
    }
}

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


fn solve() {
    let v: Vec<char> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().chars().collect()
    };

    let mut ans = vec!['0'; v.len()];
    for (i, c) in v.iter().enumerate() {
        if (*c == '9' && i != 0) || *c == '8' || *c == '7' || *c == '6' || *c == '5' {
            ans[i] = ('9' as u8 - (*c as u8) + '0' as u8) as char;
        } else {
            ans[i] = *c;
        }
    }

    let mut i = 0;
    while i < ans.len() && ans[i] == '0' {
        i += 1;
    }

    if i == ans.len() {
        println!("9");
    } else {
        for x in i..ans.len() {
            print!("{}", ans[x]);
        }
        println!();
    }
}

fn main() {
    solve();
}


use std::io::stdin;
fn main() {
	let mut s = String::new();
	stdin().read_line(&mut s).unwrap();
	let a: Vec<i64> = s
		.split_whitespace()
		.map(|x| x.parse().unwrap())
		.collect();
	println!("{} {}", std::cmp::min(a[0], a[1]), (a[0] - a[1]).abs()/2)
}


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

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let arr : Vec<i32> = s.split_whitespace().map(|s| s.parse().unwrap()).collect();
    let (a, b, x) = (arr[0], arr[1], cmp::min(arr[0], arr[1]));
    println!("{} {}", x, (a + b - 2 * x) / 2);
}


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

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

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


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

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

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

// Functions

// Main
fn main() {

    input! {
        N: usize,
        A: [i64; N]
    }

    let mut ans = 0;

    for i in 0..N {
        for j in i..N{
            let mut cnt = 0;
            for x in 0..N{
                if (x < i || j < x) && A[x]==1 {
                    cnt += 1;
                } else if i <= x && x <= j && A[x]==0 {
                    cnt += 1;
                }
            }
            ans = max(ans,cnt);
        }
    }

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


/*
 *
 * Author : fcbruce <fcbruce8964@gmail.com>
 *
 * Time : Sat 10 Feb 2018 18:51:25
 *
 */

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

  return y == 0 && x == 0 || 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[1] > vals[0] + 1{
        printable = false;
    }

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

}


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

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

fn solve() {
    let k = parse_line!(u64);
    let mut base: u64 = 1;
    while (base + 1).pow(10) < k {
        base += 1;
    }
    let mut up = 0;
    while base.pow(10 - up) * (base + 1).pow(up) < k {
        up += 1;
    }
    for (i, c) in "codeforces".to_string().chars().enumerate() {
        for _ in 0..base {
            print!("{}", c);
        }
        if i < up as usize {
            print!("{}", c);
        }
    }
    println!();
}

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


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

use std::io::Read;

struct State {
    k: i64,
}

const C: &str = "codeforces";
fn solve(st: &mut State) {
    let s: Vec<char> = C.chars().collect();
    let k = st.k;
    let mut cnt: [i64; 10] = [1; 10];
    let mut cur: i64 = 1;
    let mut id = 0;
    while cur < k {
        cur /= cnt[id % 10];
        cnt[id % 10] += 1;
        cur *= cnt[id % 10];
        id += 1;
    }
    for i in 0..10 {
        for _ in 0..cnt[i] {print!("{}", s[i]);}
    }
    print!("\n");
}
fn main() {
    let mut buffer = String::new();
    std::io::stdin().read_to_string(&mut buffer).unwrap();
    let mut input = buffer.split_whitespace();

    let t: usize = 1;//input.next().unwrap().parse().unwrap();
    for _ in 0..t {
        let k: i64 = input.next().unwrap().parse().unwrap();
        //let s: usize = input.next().unwrap().chars().collect();
        //let a: Vec<usize> = (0..n).map(|_| input.next().unwrap().parse().unwrap()).collect();
        solve(&mut State{k: k});
    }

}


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, mut 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 {
        if k <= n/3 {
            2*k
        } else {
            let used = n/3;
            let extra = n % 3;
            let leftover = k - used - extra;
            if leftover > 0 {
                2*used - leftover
            } else if leftover == 0 {
                2*used
            } else {
                2*used + 1
            }
        }
    };

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

}


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

// scanner from https://codeforces.com/contest/1396/submission/91365784
struct Scanner {
    stdin: Stdin,
    buffer: VecDeque<String>,
}
#[allow(dead_code)]
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
    fn u(&mut self) -> usize {
        self.cin()
    }
    fn ll(&mut self) -> i64 {
        self.cin()
    }
    fn ull(&mut self) -> u64 {
        self.cin()
    }
    fn vecu(&mut self, n: usize) -> Vec<usize> {
        self.vec(n)
    }
    fn vecll(&mut self, n: usize) -> Vec<i64> {
        self.vec(n)
    }
}

#[derive(Clone, Debug, Default)]
struct Solver {}

//
// DSU
//

#[derive(Debug, Clone)]
struct DSU {
    v: Vec<usize>,
    n: usize,
}

impl DSU {
    fn new(size: usize) -> DSU {
        let mut v = vec![0; size];
        for i in 0..size {
            v[i] = i;
        }
        DSU { v: v, n: size }
    }

    fn find(&mut self, x: usize) -> usize {
        if self.v[x] == x {
            x
        } else {
            self.v[x] = self.find(self.v[x]);
            self.v[x]
        }
    }

    fn is_same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }

    fn unify(&mut self, x: usize, y: usize) {
        let xx = self.find(x);
        let yy = self.find(y);
        if xx != yy {
            self.v[yy] = xx;
        }
    }
}

//
// Segment Tree
//

#[derive(Clone)]
struct SegmentTree<T> {
    v: Vec<T>,
    offset: usize,
    comb: fn(T, T) -> T,
    unit: T,
}

#[allow(dead_code)]
impl<T: Copy> SegmentTree<T> {
    fn new(n: usize, unit: T, comb: fn(T, T) -> T, vv: Option<&Vec<T>>) -> SegmentTree<T> {
        let mut x = 1;
        while x < n {
            x *= 2;
        }

        let mut v = vec![unit; x * 2];
        if let Some(vv) = vv {
            for i in 0..n {
                v[x + i] = (*vv)[i];
            }
            for i in (0..x).rev() {
                v[i] = comb(v[i * 2], v[i * 2 + 1]);
            }
        }

        SegmentTree {
            v: v,
            offset: x,
            comb,
            unit: unit,
        }
    }

    fn update(&mut self, pos: usize, val: T) {
        let mut p = self.offset + pos;
        self.v[p] = val;
        while p != 1 {
            p /= 2;
            self.v[p] = (self.comb)(self.v[p * 2], self.v[p * 2 + 1]);
        }
    }

    fn get(&self, pos: usize) -> T {
        self.v[self.offset + pos]
    }

    fn query_range_all(&self) -> T {
        self.query_range(0, self.offset)
    }

    fn query_range(&self, begin: usize, end: usize) -> T {
        self.query_range_sub(begin, end, 1, 0, self.offset)
    }

    // v[node] は 区間 l .. r-1 の計算結果を持っている
    fn query_range_sub(&self, begin: usize, end: usize, node: usize, l: usize, r: usize) -> T {
        if end <= l || r <= begin {
            return self.unit.clone();
        } else if begin <= l && r <= end {
            return self.v[node].clone();
        } else {
            let lval = self.query_range_sub(begin, end, node * 2, l, (l + r) / 2);
            let rval = self.query_range_sub(begin, end, node * 2 + 1, (l + r) / 2, r);
            return (self.comb)(lval, rval);
        }
    }
}

impl Solver {
    fn solve(&mut self, scan: &mut Scanner, out: &mut BufWriter<Stdout>) {
        //1416d

        let n = scan.u();
        let m = scan.u();
        let q = scan.u();
        let p = scan.vecu(n);

        let mut edges = Vec::with_capacity(m);
        for _ in 0..m {
            let x = scan.u() - 1;
            let y = scan.u() - 1;
            edges.push((x, y));
        }

        let mut vq = Vec::with_capacity(q);
        let mut vq1 = Vec::with_capacity(q); // vertex : そのグループ内の最大のpを0にする
        let mut vq2 = Vec::with_capacity(q); // edge : (edge_id, Some(r_vertex_id)) このクエリを処理するときに e_vertex_id 以降を切り離す

        let mut eid_to_q2id = vec![q; m];
        for _ in 0..q {
            let x = scan.u();
            let y = scan.u();
            vq.push(x);

            if x == 1 {
                vq1.push(y - 1);
            } else {
                eid_to_q2id[y - 1] = vq2.len();
                vq2.push((y - 1, None));
            }
        }

        /*
           エッジ削除のクエリを逆順にして、このクエリはどのグループとどのグループをくっつけるか、をDSUを使って調べる。
           x-yにエッジを追加 = (xのroot)の子として(yのroot)を追加
           x-yのエッジを削除 = (xのroot)から(yのroot)を切り離す

        */
        let mut eidq2id: Vec<(usize, usize)> = eid_to_q2id.into_iter().enumerate().collect(); // (edge_id, query2_id)
        eidq2id.sort_by_key(|x| q - x.1);

        let mut dsu = DSU::new(n);
        let mut child = vec![Vec::new(); n];
        for (edge_id, q2id) in eidq2id {
            let e = edges[edge_id];
            if !dsu.is_same(e.0, e.1) {
                let e0 = dsu.find(e.0);
                let e1 = dsu.find(e.1);
                dsu.unify(e0, e1);

                child[e0].push(e1);
                if q2id != q {
                    vq2[q2id].1 = Some(e1);
                }
            }
        }
        /*
           頂点の順番を並び替える。
           各rootからdfsで通った順にする。
           (xのroot)から(yのroot)を切り離す は、 (yのroot)の手前で分割する と同じになる
        */
        let mut pos_to_vid = Vec::with_capacity(n);
        fn dfs(vid: usize, pos_to_vid: &mut Vec<usize>, child: &Vec<Vec<usize>>) {
            pos_to_vid.push(vid);
            for &child_vid in &child[vid] {
                dfs(child_vid, pos_to_vid, child);
            }
        }

        let mut partitions = BTreeSet::new();
        partitions.insert(0);
        for i in 0..n {
            if i == dsu.find(i) {
                dfs(i, &mut pos_to_vid, &child);
            }
            partitions.insert(pos_to_vid.len());
        }

        //
        let mut vid_to_pos = vec![0; n];
        let mut v = vec![(0, 0); n];
        for pos in 0..n {
            let vid = pos_to_vid[pos];
            v[pos] = (p[vid], vid);
            vid_to_pos[vid] = pos;
        }
        let mut s = SegmentTree::new(n, (0usize, 0usize), |l, r| max(l, r), Some(&v));

        vq1.reverse();
        vq2.reverse();
        for i in 0..q {
            // for pos in 0..n {
            //     if partitions.contains(&pos) {
            //         print!("|");
            //     }
            //     let (val, vid) = s.v[s.offset + pos];
            //     print!("({} {}) ", val, vid + 1);
            // }
            // println!("");

            if vq[i] == 1 {
                let vid = vq1.pop().unwrap();
                let pos = vid_to_pos[vid];
                let lpos = partitions.range(..=pos).next_back().unwrap();
                let rpos = partitions.range(pos + 1..).next().unwrap();
                let (val2, vid2) = s.query_range(*lpos, *rpos);
                //println!("range pos{} -> {}..{}  val,vid={},{}", pos, *lpos, *rpos, val2, vid2 );
                writeln!(out, "{}", val2).ok();
                s.update(vid_to_pos[vid2], (0, vid2));
            } else {
                if let Some((_, Some(vid))) = vq2.pop() {
                    partitions.insert(vid_to_pos[vid]);
                }
            }
        }
    }
}

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

    let testcase = 1;
    //let testcase: usize = scan.cin();
    for _ in 0..testcase {
        let mut s: Solver = Default::default();
        s.solve(&mut scan, out);
    }
}

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


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

// Simple DSU {{{
struct DSU {
	n: usize,
	par: Vec<usize>
}
#[allow(dead_code)]impl DSU {
	fn new(n: usize) -> Self { let mut d = Self {n:0, par:Vec::new()}; d.resize(n); d }
	fn resize(&mut self, n: usize) { self.n = n; self.par.resize(n, 0); self.reset(); }
	fn reset(&mut self) { for i in 0..self.n { self.par[i] = i; } }
	fn find(&mut self, a: usize) -> usize {
		if a != self.par[a] { self.par[a] = self.find(self.par[a]); } self.par[a] }
	fn union(&mut self, mut a: usize, mut b: usize) -> bool {
		a = self.find(a); b = self.find(b); if a != b { self.par[a] = b; true } else { false } }
}//}}}
// Simple Segtree {{{
mod simple_full_segtree {
	pub type V = (i32,usize);
	pub type U = V;
	pub type R = V;
	#[derive(Clone)]
	pub struct Val {
		val: V
	}
	impl Val {
		pub fn default() -> Self {
			Self::new((0,0))
		}
		pub fn new(v: V) -> Self {
			Self {val: v}
		}
		pub fn combine(a: &Self, b: &Self) -> Self {
			Self::new(a.val.max(b.val))
		}
		pub fn update(&mut self, u: U) {
			self.val = u;
		}
		pub fn result(&self) -> R {
			self.val
		}
	}
	pub struct Tree {
		n: usize,
		base: usize,
		values: Box<[Val]>
	}
	#[allow(dead_code)]
	impl Tree {
		pub fn new(init: &[V]) -> Self {
			let n = init.len();
			let mut base = 1;
			while base < n {
				base <<= 1;
			}
			let mut values = vec![Val::default(); base*2];
			for i in 0..n {
				values[base + i] = Val::new(init[i]);
			}
			for i in (1..base).rev() {
				values[i] = Val::combine(&values[i+i], &values[i+i+1]);
			}
			let values = values.into_boxed_slice();
			Self {n, base, values}
		}
		pub fn update(&mut self, p: usize, u: U) {
			assert!(p < self.n);
			let mut p = p + self.base;
			self.values[p].update(u);
			p >>= 1;
			while p > 0 {
				self.values[p] = Val::combine(&self.values[p+p], &self.values[p+p+1]);
				p >>= 1;
			}
		}
		fn query_sub(&self, ql: usize, qr: usize, l: usize, r: usize, id: usize, val: &mut Val) {
			if r < ql || qr < l { return; }
			if ql <= l && r <= qr {
				*val = Val::combine(val, &self.values[id]);
			} else if ql <= r && l <= qr {
				let m = (l+r) >> 1;
				self.query_sub(ql, qr, l, m, id+id, val);
				self.query_sub(ql, qr, m+1, r, id+id+1, val);
			}
		}
		pub fn query(&self, ql: usize, qr: usize) -> Val {
			assert!(ql <= qr && qr < self.n);
			let mut res = Val::default();
			self.query_sub(ql, qr, 0, self.base-1, 1, &mut res);
			res
		}
		pub fn query_all(&self) -> Val {
			self.values[1].clone()
		}
	}
}//}}}

fn dfs(u: usize, e: &[Vec<usize>], dfst: &mut [(usize,usize)], t: &mut usize) {
	dfst[u].0 = *t;
	*t += 1;
	for &v in e[u].iter() {
		assert!(dfst[v] == (1,0));
		dfs(v, e, dfst, t);
	}
	dfst[u].1 = *t-1;
}

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

	l!(n,m,q = rin.u());
	let p = rin.vi(n);
	let mut el = v!([m]);
	let mut e = v!([n][]);
	for i in 0..m {
		l!(a,b = rin.u()-1);
		el.push( (a,b,q) );
		e[a].push( (b,i) );
		e[b].push( (a,i) );
	}
	let mut qq = v!([q]);
	for i in 0..q {
		let t = rin.u();
		let x = rin.u()-1;
		qq.push( (t,x) );
		if t == 2 {
			el[x].2 = i;
		}
	}
	let mut dsu = DSU::new(n*2);
	for i in 0..m {
		let (a,b,t) = el[i];
		if t == q {
			dsu.union(a,b);
		}
	}
	let mut heads = v!([n*2] = 0);
	let mut de = v!([n*2][]);
	for u in 0..n {
		let v = dsu.find(u);
		if v != u {
			de[v].push(u);
		} else {
			heads[u] = u;
		}
	}
	let mut nn = n;
	let mut qt = v!([q] = None);
	for i in (0..q).rev() {
		let (t,x) = qq[i];
		if t == 2 {
			let (a,b,_) = el[x];
			let aa = heads[dsu.find(a)];
			let bb = heads[dsu.find(b)];
			if aa != bb {
				dsu.union(a,b);
				dsu.union(a,nn);
				heads[dsu.find(a)] = nn;
				de[nn].push(aa);
				de[nn].push(bb);
				qt[i].replace(nn);
				nn += 1;
			}
		}
	}
	let mut dfst = v!([n*2] = (1,0));
	let mut t = 0;
	for i in (0..nn).rev() {
		if dfst[i] == (1,0) {
			dfs(i, &de, &mut dfst, &mut t);
		}
	}
	let mut intervals = BTreeSet::new();
	for i in 0..nn {
		if i == heads[dsu.find(i)] {
			let (s,e) = dfst[i];
			intervals.insert( (e,s) );
		}
	}
	let mut z = v!([nn] = (0,0));
	for i in 0..n {
		z[dfst[i].0] = (p[i],i);
	}
	// writeln!(rout, "z : {:?}", z).ok();
	// for i in 0..nn {
	// 	writeln!(rout, "{} : {:?}", i, dfst[i]).ok();
	// }
	// writeln!(rout, "intervals : {:?}", intervals).ok();
	use std::ops::Bound::*;
	let mut st = simple_full_segtree::Tree::new(&z);
	for i in 0..q {
		let (t,x) = qq[i];
		if t == 1 {
			let (r,l) = *intervals.range((Included( (dfst[x].0,0) ),Unbounded)).next().unwrap();
			let (v,pos) = st.query(l,r).result();
			// writeln!(rout, "query {} {} : {} {}", l, r, v, pos).ok();
			if v > 0 {
				st.update(dfst[pos].0, (0,0));
			}
			writeln!(rout, "{}", v).ok();
		} else if let Some(id) = qt[i] {
			assert!(de[id].len() == 2);
			let a = de[id][0];
			let b = de[id][1];
			intervals.remove( &(dfst[id].1,dfst[id].0) );
			intervals.insert( (dfst[a].1,dfst[a].0) );
			intervals.insert( (dfst[b].1,dfst[b].0) );
		}
	}
}


#[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::prelude::BufRead;
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufReader, BufWriter, Write};
#[allow(unused_imports)]
use std::mem::swap;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
	let _n = read::<usize>();
	let arr = read_vector::<i64>();
	for i in 0..101 {
		for &x in [arr[0], arr[0] + i, arr[0] - i].iter() {
			let mut possible = true;
			for &val in arr.iter() {
				if val != x && val + i != x && val - i != x {
					possible = false;
					break;
				}
			}
			if possible {
				println!("{}", i);
				return;
			}
		}
	}
	println!("{}", -1);
}

#[allow(dead_code)]
fn read<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    return buf.trim().parse().unwrap();
}

#[allow(dead_code)]
fn read_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    let mut buf = String::with_capacity(100);
    stdin().read_line(&mut buf).unwrap();
    return buf.split_whitespace().map(|s| s.parse().unwrap()).collect();
}

#[allow(dead_code)]
fn read_matrix<T>() -> Vec<Vec<T>>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug,
{
    use std::io::prelude::*;
    let stdin = stdin();
    let mut reader = BufReader::with_capacity(100 * 1024, stdin);
    let mut line = String::with_capacity(100);
    let mut matrix: Vec<Vec<T>> = Vec::new();

    while reader.read_line(&mut line).unwrap() > 0 {
        matrix.push(
            line.trim()
                .split_whitespace()
                .map(|s| s.parse().unwrap())
                .collect(),
        );
        line.clear();
    }

    return matrix;
}

#[allow(dead_code)]
fn read_chars() -> Vec<char> {
    let stdin = stdin();
    let mut buf = String::new();
    let _bytes = stdin.read_line(&mut buf).unwrap();
    return buf.trim().chars().collect();
}


fn get_d(elements: Vec<u32>) -> Option<u32> {
    assert!(elements.len() > 0);

    let min: u32 = *elements.iter().min().unwrap();
    let max: u32 = *elements.iter().max().unwrap();

    if ((min + max) % 2) != 0 {
        for element in elements {
            if (element != min) && (element != max) {
                return None;
            }
        }
        return Some(max - min);
    }
    let mid: u32 = (min + max) / 2;
    for element in elements {
        if (element != min) && (element != max) && (element != mid) {
            return None;
        }
    }
    return Some((max - min) / 2);
}

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

    #[test]
    fn test1() {
        assert_eq!(get_d(vec![1, 4, 4, 7, 4, 1]), Some(3));
    }
    #[test]
    fn test2() {
        assert_eq!(get_d(vec![2, 2, 5, 2, 5]), Some(3));
    }
    #[test]
    fn test3() {
        assert_eq!(get_d(vec![1, 3, 3, 7]), None);
    }
    #[test]
    fn test4() {
        assert_eq!(get_d(vec![2, 8]), Some(3));
    }
}

fn read_data() -> Vec<u32> {
    let mut _num_str: String = String::new();
    std::io::stdin().read_line(&mut _num_str).unwrap();

    let mut data_str: String = String::new();
    std::io::stdin().read_line(&mut data_str).unwrap();

    return data_str
        .trim()
        .split(" ")
        .map(|s| s.parse::<u32>().unwrap())
        .collect();
}

fn main() {
    let elements: Vec<u32> = read_data();
    let d: Option<u32> = get_d(elements);

    match d {
        Some(d_value) => println!("{}", d_value),
        None => println!("-1"),
    }
}


#![allow(unused_imports)]
use std::io::*;
use std::cmp::*;
use std::collections::*;

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

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

impl Scanner {

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

   fn process(&mut self) -> String {
      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      self.buffer.pop_front().unwrap()
   }

   #[allow(dead_code)]
   fn next<T : std::str::FromStr >(&mut self) -> T {
      self.process().parse::<T>().ok().unwrap()
   }

   #[allow(dead_code)]
   fn next_char(&mut self) -> char {
      self.process().into_bytes()[0] as char
   }
}

fn main() {
    let mut sin = Scanner::new();
    let (a, b, c) : (i32, i32, i32) = (sin.next(), sin.next(), sin.next());
    let (x, y, z) : (i32, i32, i32) = (sin.next(), sin.next(), sin.next());

    let extra = max(0, a - x)/2 + max(0, b - y)/2 + max(0, c - z)/2;
    let need = max(0, x - a) + max(0, y - b) + max(0, z - c);

    if extra < need {
        println!("NO");
    } else {
        println!("YES");
    }
}


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

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

fn main() {
    read_line!(month; usize, start_weekday; usize);
    let days = match month {
        1 | 3 | 5 | 7 | 8 | 10 | 12 => 31,
        4 | 6 | 9 | 11 => 30,
        2 => 28, // Assume that the year is non-leap.
        _ => 0
    };
    let days_first_column = 7 - start_weekday + 1;
    let days_remaining = days - days_first_column;
    let columns = (days_remaining as f64 / 7.0).ceil() as usize + 1;
    println!("{}", columns);
}


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

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

    println!("{}", ["","1/1","5/6","2/3","1/2","1/3","1/6"][input.u().max(input.u())]);
}


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

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

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

//

// ---------- begin chmin, chmax ----------
trait ChangeMinMax {
    fn chmin(&mut self, x: Self) -> bool;
    fn chmax(&mut self, x: Self) -> bool;
}

impl<T: PartialOrd> ChangeMinMax for T {
    fn chmin(&mut self, x: Self) -> bool {
        if *self > x {
            *self = x;
            true
        } else {
            false
        }
    }
    fn chmax(&mut self, x: Self) -> bool {
        if *self < x {
            *self = x;
            true
        } else {
            false
        }
    }
}
// ---------- end chmin, chmax ----------

use std::cmp::*;

fn run() {
    input! {
        n: usize,
        p: [(chars, [i32; 2]); n],
    }
    let mut p = p
        .into_iter()
        .map(|p| ((p.0[0] == 'B') as usize, [p.1[0], p.1[1]]))
        .collect::<Vec<_>>();
    let mut need = [0; 2];
    for p in p.iter_mut() {
        let n = n as i32;
        for (need, v) in need.iter_mut().zip(p.1.iter_mut()) {
            *need += max(0, *v - n);
            v.chmin(n);
        }
    }
    let mut sum = vec![[0i32; 2]];
    for &(x, _) in p.iter() {
        for i in 0..sum.len() {
            let mut a = sum[i];
            a[x] += 1;
            sum.push(a);
        }
    }
    let inf = std::i32::MAX / 2;
    let mut dp = vec![vec![vec![inf; 1 << n]; n.pow(2) + 1]; 2];
    let abs = (need[1] - need[0]).abs() as usize;
    dp[(need[0] >= need[1]) as usize][min(n * n, abs)][0] = 0;
    for bit in 0..(1 << n) {
        let sum = sum[bit];
        for rem in 0..=n.pow(2) {
            for i in 0..2 {
                let v = dp[i][rem][bit];
                if v == inf {
                    continue;
                }
                for (j, &(_, p)) in p.iter().enumerate() {
                    let k = bit | (1 << j);
                    if k == bit {
                        continue;
                    }
                    let p = [max(0, p[0] - sum[0]), max(0, p[1] - sum[1])];
                    if rem as i32 + p[i ^ 1] >= p[i] {
                        let x = rem as i32 + p[i ^ 1] - p[i];
                        let v = v + p[i ^ 1];
                        dp[i][min(x as usize, n.pow(2))][k].chmin(v);
                    } else {
                        let x = p[i] - rem as i32 - p[i ^ 1];
                        let v = v + p[i] - rem as i32;
                        dp[i ^ 1][min(x as usize, n.pow(2))][k].chmin(v);
                    }
                }
            }
        }
    }
    let add = need.iter().copied().max().unwrap() + n as i32;
    let ans = add + dp.into_iter().flatten().map(|dp| dp[(1 << n) - 1]).min().unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


type Pair = (i32, i32);
fn input_pair() -> Pair {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let buf: Vec<i32> = buf.trim().split_whitespace().map(|elem| elem.parse().unwrap()).collect();
    (buf[0], buf[1])
}

fn solve(n: i32, m: i32, r: i32) -> i32 {
    match n {
        0 => 0,
        n => n + solve((n+r) / m, m, (n+r) % m)
    }
}

fn main() {
    let (n, m) = input_pair();
    println!("{}", solve(n, m, 0));
}


// {{{ by shik

use std::io;

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

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

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

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

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

// }}}

fn main() {
    let (n, m) = R!(usize, usize);
    let mut cur: usize = n;
    for day in 1.. {
        cur -= 1;
        if day % m == 0 {
            cur += 1;
        }
        if cur == 0 {
            println!("{}", day);
            break;
        }
    }
}


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

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

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

fn read_vector<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    read_line().trim().split_whitespace().map(|x| x.parse::<T>().unwrap()).collect()
}

fn calculate_min_max_pairs(n: u64, m: u64) -> (u64, u64) {
    let get_pair_count = |x| x * (x - 1) / 2;
    let max_count = get_pair_count(n - m + 1);
    let (d, r) = (n / m, n % m);
    let min_count = (m - r) * get_pair_count(d) + r * get_pair_count(d + 1);
    (min_count, max_count)
}

fn main() {
    let (n, m) = {
        let v = read_vector::<u64>();
        (v[0], v[1])
    };
    let result = calculate_min_max_pairs(n, m);
    println!("{} {}", result.0, result.1);
}


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

#[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 foo(x : i32) -> i64 {
    let x : i64 = x as i64;
    return (x*(x-1))/2;
}

fn main() {
    let (n,m) = readln!(i32,i32);
    let a1 = foo(n-m+1);
    let r = n%m;
    let q = n/m;
    let a2 = r as i64*foo(q+1) + (m-r) as i64 *foo(q);
    println!("{} {}",a2,a1);
}


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

fn main() {
	let (mut rin,mut rout) = rio();

	let n = rin.i();
	let p = rin.f();
	let mut lo = 0;
	let mut hi = n - 2;
	let mut ans = n - 1;
	while lo <= hi {
		let x = (lo + hi) / 2;
		let mut res = 0.0;
		let mut c = 0;
		for i in 0..=3 {
			let j = 3 - i;
			if i > x || j > n-x {
				continue;
			}
			let cc = if i == 0 {
				(n-x) * (n-x-1) * (n-x-2) / 6
			} else if i == 1 {
				x * (n-x) * (n-x-1) / 2
			} else if i == 2 {
				x * (x-1) * (n-x) / 2
			} else {
				x * (x-1) * (x-2) / 6
			};
			let pp = if i == 0 {
				0.0
			} else if i == 1 {
				0.5
			} else {
				1.0
			};
			res += pp * (cc as f64);
			c += cc;
		}
		assert!(c > 0);
		res /= c as f64;
		if res + 1e-9 > p {
			ans = x;
			hi = x-1;
		} else {
			lo = x+1;
		}
	}
	writeln!(rout, "{}", ans).unwrap();
}


// @robertkingnz https://twitter.com/robertkingNZ

/// Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools

/// To modify the template, go to Preferences -> Editor -> File and Code Templates -> Other

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

fn main() -> io::Result<()> {
    let mut s = String::new();
    io::stdin().read_to_string(&mut s)?;
    let mut it = s
        .split_whitespace()
        .map(|s| s.to_string());
    let mut out = String::new();
    let n: i32 = it.next().unwrap().parse().unwrap();
    let p: f64 = it.next().unwrap().parse().unwrap();
    for x in 0..=n {
        let x = x as f64;
        let n = n as f64;
        let c0 = (n-x)/n * (n-x-1.0)/(n-1.0) * (n-x-2.0)/(n-2.0);
        let c1 = x/n * (n-x)/(n-1.0) * (n-x-1.0)/(n-2.0) +
            (n-x)/n * x/(n-1.0) * (n-x-1.0)/(n-2.0) +
            (n-x)/n * (n-x-1.0)/(n-1.0) * x/(n-2.0);
        let c3 = x/n * (x-1.0)/(n-1.0) * (x-2.0)/(n-2.0);
        let c2 = 1.0 - c0 - c1 - c3;
        // println!("{} {} {} {} {}", x, c0, c1, c2, c3);
        let y = c1/2.0 + c2 + c3;
        // println!("{} {} {} {}", x, c1, c2, c3);
        if y >= p-0.00000001 {
            let ans = format!("{}\n", x);
            out.push_str(ans.as_str());
            print!("{}", out);
            break;
        }
    }
    Ok(())
}

/*
n maps
P(x) >= p

c0*p0 + c1*p1 +.. +c3*p3 > p

c(i) = choose(n, i)/choose(n, 3)
p(i) =
if i = 3 -> 1.0
if i = 2 -> 1.0
if i = 1 -> 1/3 * ( same_bad = 1/2 + other_bad = 1 + only_good = 0  ) = 1/3 * 3/2  = 1/2
if i = 0 -> 0

c0*0+ c1/2 + c2*1 + c3*2
= c1/2 + c2 + c3

n choose 3 = n*(n-1)*(n-2)
x choose 1 = x
x choose 2 = x*(x-1)
x choose 3 = x*(x-1)*(x-3)

7:
p(1) = 1/2
c(1) = 1/2
1/4

1/7
6/7 (
1/6
5/6 (
1/5
0
)
)

1/7 + 6/7*(1/6+5/6*(1/5)) = 3/7 = 0.42867
 */


use std::io;

#[allow(dead_code)]
fn main() {
    let mut input = "".split_ascii_whitespace();
    let mut read = || loop {
        if let Some(word) = input.next() {
            break word;
        }
        input = {
            let mut input = "".to_owned();
            io::stdin().read_line(&mut input).unwrap();
            if input.is_empty() {
                panic!("reached EOF");
            }
            Box::leak(input.into_boxed_str()).split_ascii_whitespace()
        };
    };
    macro_rules! read(($ty:ty) => (read().parse::<$ty>().unwrap()));

    let n = read!(usize);

    let r = if n < 11 || n > 21 {
        0
    } else if n == 20 {
        15
    } else {
        4
    };
    println!("{}", r);
}


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

    let mut it = input.split_whitespace();

    let n: usize = it.next().unwrap().parse().unwrap();
    let mut g: Vec<usize> = it.take(n).map(|x| x.parse().unwrap()).collect();
    g.sort_unstable();

    let t: Vec<_> = std::iter::once(0).chain(g.into_iter().rev().scan(0, |state, x| {
        *state += 2 * x;
        Some(*state)
    })).collect();

    let target = 9 * n;

    let ans = match t.into_iter().rev().enumerate().position(|(i, x)| x + 10 * i >= target) {
        None => n,
        Some(p) => p,
    };
    println!("{}", ans);
}


use std::io;

fn main() {
    let n = getint();
    let k = getint();
    let a = getint();
    let b = getint();

    println!("{}",find_min_cost(n,k,a,b,0));
}

fn getint() -> i64 {
    let mut inpstr = String::new();
    io::stdin().read_line(&mut inpstr).expect("Could not read integer");
    let number = inpstr.trim().parse::<i64>();

    number.unwrap()

}

fn find_min_cost(n : i64, k: i64, a : i64, b : i64, acc: i64) ->  i64 {
    if n == 1 {
        return acc;
    }

    let rem = n%k;

    if rem != 0 {
        return find_min_cost(n - rem, k, a, b, acc+ a*rem);
    }

    let quo = n/k;

    if quo*a + b < n*a {
        return find_min_cost(quo, k, a, b, acc+ b);
    }

    (n-1)*a + acc
}


use std::io;

fn main() {
    let n = getint();
    let k = getint();
    let a = getint();
    let b = getint();

    println!("{}",find_min_cost(n,k,a,b,0));
}

fn getint() -> i64 {
    let mut inpstr = String::new();
    io::stdin().read_line(&mut inpstr).expect("Could not read integer");
    let number = inpstr.trim().parse::<i64>();

    number.unwrap()

}

//Implements greedy algorithm, acc is the accumulator
fn find_min_cost(n : i64, k: i64, a : i64, b : i64, acc: i64) ->  i64 {
    if n == 1 {
        return acc;
    }

    let rem = n%k;

    if rem != 0 {
        return find_min_cost(n - rem, k, a, b, acc+ a*rem);
    }

    let quo = n/k;

    if quo*a + b < n*a {
        return find_min_cost(quo, k, a, b, acc+ b);
    }

    (n-1)*a + acc
}


use std::io;

const YES: &'static str = "Yes";
const NO: &'static str = "No";

pub fn can_reward(num: Vec<u32>) -> &'static str {
    if num[0] > num[1] || num[0] > num[2] {
        return NO;
    }

    YES
}

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

    io::stdin().read_line(&mut num)?;
    let numbers: Vec<u32> = num
        .trim()
        .split(" ")
        .map(|num| num.parse::<u32>().expect("Couldn't parse number"))
        .collect();

    println!("{}", can_reward(numbers));
    Ok(())
}

fn main() {
    solution();
}


use std::io;

fn main() {
	let mut input=String::new();
	io::stdin().read_line(&mut input).expect("Time to panic");
	let input: Vec<&str> = input.trim().split(' ').collect();
	let n:u8 = input[0].parse().unwrap();
	let m:u8 = input[1].parse().unwrap();
	let k:u8 = input[2].parse().unwrap();
	if m < n || k < n {
		println!("No");
	} else {
		println!("Yes");
	}
}


use std::io;

fn read() -> Vec<String> {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let numbers: Vec<String> = line
        .split_whitespace()
        .map(|s| s.trim().to_string()).collect();
    numbers
}

fn main() {
    let numbers = read();
    let a = &numbers[0];
    let b = &numbers[1];
    if a == b {
        println!("{}", a);
    } else {
        println!("{}", 1);
    }
}


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

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

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

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

fn is_unimodal(a: Vec<i64>) -> bool {
    let max_value = *a.iter().max().unwrap();
    let first_index = a.iter().position(|&v| v == max_value).unwrap();
    let last_index = a.iter().rposition(|&v| v == max_value).unwrap();
    // println!("{} {}", first_index, last_index);
    for i in first_index..(last_index + 1) {
        if a[i] != max_value {
            return false;
        }
    }
    for i in 0..first_index {
        if a[i] >= a[i + 1] {
            return false;
        }
    }
    for i in last_index..(a.len() - 1) {
        if a[i] <= a[i + 1] {
            return false;
        }
    }
    true
}

fn main1() {
    let stdin = io::stdin();
    let mut input = Scanner::new(stdin.lock());
    let n: usize = input.next();
    let a: Vec<i64> = input.next_vec(n);
    println!("{}", if is_unimodal(a) {"YES"} else {"NO"});
}

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


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

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

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

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

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

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

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

fn main() {
  scanln!(_n: u32);
  scanln!(ns: Vec<u32>);
  enum Section { Increasing, Constant, Decreasing };
  let mut last = ns[0];
  let mut section = Section::Increasing;
  for &n in ns.iter().skip(1) {
    match section {
      Section::Increasing => {
        if n > last {
          last = n;
          section = Section::Increasing;
        } else if n == last {
          section = Section::Constant;
        } else {
          last = n;
          section = Section::Decreasing;
        }
      },
      Section::Constant => {
        if n == last {
          section = Section::Constant;
        } else if n < last {
          last = n;
          section = Section::Decreasing;
        } else {
          println!("NO");
          return;
        }
      },
      Section::Decreasing => {
        if n < last {
          last = n;
          section = Section::Decreasing;
        } else {
          println!("NO");
          return;
        }
      }
    }
  }
  println!("YES");
}


use std::cmp::max;

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

    let (n, k): (usize, usize) = (input.next(), input.next());

    let mut v = [0i32; 200];
    for i in 0..n {
        v[i] = input.next();
    }

    let mut maximum = std::i32::MIN;
    for b in 0..n {
        let mut c = 0;
        for i in 0..n {
            if (b + i) % k != 0 {
                c += v[i];
            }
        }
        maximum = max(c.abs(), maximum);
    }

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

#[allow(unused)]
pub mod io {

    const BUFFER_SIZE: usize = 8192;

    use std::collections::VecDeque;
    use std::str::FromStr;
    use std::io;
    use std::io::Read;

    type AsciiStr = Vec<u8>;

    pub struct Input {
        token_buffer: VecDeque<String>,
        remaining: String,
    }

    impl Input {

        pub fn new() -> Input {
            Input {
                token_buffer: VecDeque::with_capacity(100),
                remaining: String::new(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T
            where T::Err: ::std::fmt::Debug
        {
            self.fill_buffer();
            self.token_buffer.pop_front().unwrap().parse().unwrap()
        }

        pub fn next_ascii_string(&mut self) -> AsciiStr {
            self.fill_buffer();
            Vec::from(self.token_buffer.pop_front().unwrap().as_bytes())
        }

        fn fill_buffer(&mut self) {
            while self.token_buffer.is_empty() {
                let mut minibuffer = [0u8; BUFFER_SIZE];
                let size = io::stdin().read(&mut minibuffer[..]).unwrap();

                self.remaining += &String::from_utf8_lossy(&minibuffer[..size]);

                if self.remaining.trim().len() > 0 {
                    for token in self.remaining.trim().split_whitespace() {
                        self.token_buffer.push_back(String::from(token))
                    }

                    if size > 0 && ! self.remaining.ends_with(|c: char|char::is_ascii_whitespace(&c)) {
                        self.remaining = self.token_buffer.pop_back().unwrap();
                    } else {
                        self.remaining.clear();
                    }

                } else if size == 0 {
                    panic!("EOF");
                }
            }
        }
    }
}


#[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)]
struct Writer {
    s: String,
}
#[allow(unused_imports)]
use std::fmt::Display;
#[allow(dead_code)]
#[doc = " let mut writer = Writer::new();"]
#[doc = " writer.writeln(hoge);"]
#[doc = " ..."]
#[doc = " writer.flush()"]
impl Writer {
    #[allow(dead_code)]
    pub fn new() -> Writer {
        Writer { s: String::new() }
    }
    #[allow(dead_code)]
    pub fn flush(&mut self) {
        print!("{}", self.s);
        self.s.clear();
    }
    pub fn write<T: Display>(&mut self, x: T) {
        self.s.push_str(&format!("{}", x));
    }
    pub fn writeln<T: Display>(&mut self, x: T) {
        self.s.push_str(&format!("{}", x));
        self.s.push('\n');
    }
    #[allow(dead_code)]
    pub fn write_vec<T: Display>(&mut self, xs: &Vec<T>) {
        if xs.len() == 0 {
            self.writeln("");
            return;
        }
        self.write(&format!("{}", xs[0]));
        for i in 1..xs.len() {
            self.write(&format!(" {}", xs[i]));
        }
        self.writeln("");
    }
}
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) } ; }
#[allow(dead_code)]
fn main() {
    input!{
        n: usize,
        k: i64,
        x: [i64; n],
    }
    let mut one: i64 = 0;
    let mut minus_one: i64 = 0;
    for &xx in &x {
        if xx == 1 {
            one += 1;
        } else {
            minus_one += 1;
        }
    }

    let mut ans = 0;
    for i in 0..k {
        let mut one2 = one;
        let mut minus_one2 = minus_one;
        let mut ii = 0;
        while true {
            let index = i + ii * k;
            if index >= x.len() as i64 {
                break;
            }
            if x[index as usize] == 1 {
                one2 -= 1;
            } else {
                minus_one2 -= 1;
            }
            ii += 1;
        }
        ans = max(ans, (one2 - minus_one2).abs());
    }
    println!("{}", ans);
}


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

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

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

}

fn main() {
    let mut scan = Scan::new();
    let n = scan.next();
    let input: Vec<[isize;2]> = (0..n)
        .map(|_| [scan.next(), scan.next()])
        .collect();
    let mut res: usize = 0;
    for i in 0..n {
        for j in  0..n {
            if i == j { continue; }
            if input[i][0] == input[j][1] { res += 1; }
        }
    }
    println!("{}", res);
}


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

fn main()
{
    let mut a = Vec::new();
    let n = scan!(usize);
    for _ in 0..n { a.push(scan!(i32, i32)); }
    println!("{}", (0..n).map(|x| (0..n).filter(|&y| y != x && a[y].1 == a[x].0).count() as i32).sum::<i32>());
}


use std::io::{stdin, stdout, BufRead, Stdin, StdinLock, Stdout, StdoutLock, Write};

fn get_listen_times(duration: u64, first_load: u64, speed_value: u64) -> u64 {
    if first_load >= duration {
        return 1;
    }

    let mut loaded: u64 = first_load;
    let mut listen_times: u64 = 0;

    while loaded < duration {
        loaded *= speed_value;
        listen_times += 1;
    }

    return listen_times;
}

fn read_vec<T>(stdin_lock: &mut StdinLock) -> Option<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut input_str: String = String::new();
    stdin_lock.read_line(&mut input_str).ok()?;
    return Some(
        input_str
            .trim()
            .split_whitespace()
            .map(|s| s.parse::<T>())
            .collect::<Result<Vec<T>, _>>()
            .ok()?,
    );
}

#[cfg(test)]
mod test {
    use super::get_listen_times;

    #[test]
    fn test1() {
        assert_eq!(get_listen_times(5, 2, 2), 2);
    }
    #[test]
    fn test2() {
        assert_eq!(get_listen_times(5, 4, 7), 1);
    }
    #[test]
    fn test3() {
        assert_eq!(get_listen_times(6, 2, 3), 1);
    }
}

fn main() {
    let stdin: Stdin = stdin();
    let mut stdin_lock: StdinLock = stdin.lock();
    let stdout: Stdout = stdout();
    let mut stdout_lock: StdoutLock = stdout.lock();

    let values: Vec<u64> = read_vec(&mut stdin_lock).unwrap();
    let duration: u64 = values[0];
    let first_load: u64 = values[1];
    let speed_value: u64 = values[2];

    let listen_times: u64 = get_listen_times(duration, first_load, speed_value);

    writeln!(stdout_lock, "{}", listen_times).unwrap();
}


const N:usize = 505;

fn main() {

    let mut str = String::new();
	std::io::stdin().read_line(&mut str).expect("");
    let input :Vec<&str> = str.trim().split(" ").collect();
    let n = input[0].parse::<i32>().unwrap();
    let modn = input[1].parse::<i64>().unwrap();
    let mut dp0:Vec<i64> = vec![0;N*N];
    let mut dp1:Vec<i64> = vec![0;N*N];
    //let mut temp_dp0:Vec<i64> = vec![0;N*N];
    //let mut temp_dp1:Vec<i64> = vec![0;N*N];
    let shift = N*N/2;
    dp1[shift]=1;
    for _i in 1..n{
        let mut new_dp0 :Vec<i64> = vec![0;N*N];
        let mut new_dp1 :Vec<i64> = vec![0;N*N];

        //let mut new_dp0 = temp_dp0;
        //let mut new_dp1 = temp_dp1;
        //for j in 0..(N*N){
        //    new_dp0[j]=0;
        //    new_dp1[j]=0;
        ///}

        let i = _i as usize;
        let mut _j = 0;
        while _j < N*N-1{
            let j = _j as usize;
            _j += 1;
            //let j = _j as usize;
            if dp1[j]==0 &&  dp0[j]==0{
                continue;
            }

            new_dp1[j-i] = (new_dp1[j-i]+dp1[j]);
            new_dp1[j+1] = (new_dp1[j+1]-2*dp1[j] + modn + modn);
            new_dp1[j+i+2]=(new_dp1[j+i+2]+dp1[j]);

            new_dp0[j+1] = (new_dp0[j+1]+dp1[j]*(i as i64));
            new_dp0[j] = (new_dp0[j]+(modn-dp1[j])*(i as i64+1));
            new_dp0[j-i] = (new_dp0[j-i]+dp1[j]);

            let t:i64 = (i as i64 +1)*dp0[j];
            new_dp0[j] = (new_dp0[j]+t);
            new_dp0[j+1] = (new_dp0[j+1]+(modn-t)*2);
            new_dp0[j+2] = (new_dp0[j+2]+t);
        }
        //for j in shift-10..shift+11{
        //    println!("{} {}",j as i32-shift as i32,new_dp[j][0])
        //}
        for j in 0..(N*N-1){
            new_dp0[j+1]=(new_dp0[j+1]+new_dp0[j])%modn;
            new_dp1[j+1]=(new_dp1[j+1]+new_dp1[j])%modn;
        }
        for j in 0..(N*N-1){
            new_dp0[j+1]=(new_dp0[j+1]+new_dp0[j])%modn;
            new_dp1[j+1]=(new_dp1[j+1]+new_dp1[j])%modn;
        }
        //temp_dp0 = dp0;
        //temp_dp1 = dp1;
        dp0 = new_dp0;
        dp1 = new_dp1;
    }
    let mut ans:i64 = 0;
    for j in shift+1..N*N{
        ans = (ans + dp0[j])%modn;
    }
    println!("{}",ans);

}


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

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

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

}

fn _main() {
    let mut scan = Scan::new();
    let d1: usize = scan.next();
    let d2: usize = scan.next();
    let d3: usize = scan.next();
    let result = (d1+d2+d3).min((d1+d2)*2).min(d1*2+d3*2).min(d3*2+d2*2);
    println!("{}", result);
}

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


type Trio = (u32, u32, u32);
fn input_trio() -> Trio {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let buf: Vec<u32> = buf
        .trim()
        .split_whitespace()
        .map(|elem| elem.parse().unwrap())
        .collect();
    (buf[0], buf[1], buf[2])
}

fn main() {
    let (d1, d2, d3) = input_trio();
    print!(
        "{}",
        d1.min(d2) + d3.min(d1 + d2) + (d1.max(d2)).min(d1.min(d2) + d3)
    )
}


#![allow(dead_code, unused_imports)]

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

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let s = read_stdin().chars().collect::<Vec<_>>();
    let t = read_stdin().chars().collect::<Vec<_>>();
    let mut front = Vec::new();
    let mut pointer = 0;
    for c in t.iter() {
        while s[pointer] != *c {
            pointer += 1;
        }
        front.push(pointer);
        pointer += 1;
    }
    let mut back = Vec::new();
    let mut pointer = s.len() - 1;
    for c in t.iter().rev() {
        while s[pointer] != *c {
            pointer -= 1;
        }
        back.push(pointer);
        if pointer > 0 {
            pointer -= 1;
        }
    }
    back.reverse();
    //println!("{:?}", front);
    //println!("{:?}", back);
    let mut res = s.len() - front.last().unwrap() - 1;
    // println!("{} {}", res, back[0]);
    res = max(res, back[0]);
    for (f, b) in front.into_iter().zip(back.into_iter().skip(1)) {
        //println!("{} {}", b, f);
        res = max(res, b - f - 1)
    }
    println!("{}", res);
    Ok(())
}


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

struct Input {
    buffer: collections::VecDeque<String>,
}

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

    fn next<T: std::str::FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).ok();
            for word in line.split_whitespace() {
                self.buffer.push_back(word.to_string())
            }
        }

        let front = self.buffer.pop_front().unwrap();
        front.parse::<T>().ok().unwrap()
    }
}

fn main() {
    let mut input = Input::new();
    let rook_str: String = input.next();
    let knight_str: String = input.next();

    let rook_pos = (
        rook_str.chars().nth(0).unwrap() as i32 - 'a' as i32,
        rook_str.chars().nth(1).unwrap() as i32 - '1' as i32,
    );

    let knight_pos = (
        knight_str.chars().nth(0).unwrap() as i32 - 'a' as i32,
        knight_str.chars().nth(1).unwrap() as i32 - '1' as i32,
    );

    let mut count = 8 * 8;

    for j in 0..8 {
        for k in 0..8 {
            if rook_pos.0 == j || rook_pos.1 == k {
                count -= 1;
            } else if knight_pos.0 == j && knight_pos.1 == k {
                count -= 1;
            } else if (rook_pos.0 - j).abs() == 2 && (rook_pos.1 - k).abs() == 1 {
                count -= 1;
            } else if (rook_pos.0 - j).abs() == 1 && (rook_pos.1 - k).abs() == 2 {
                count -= 1;
            } else if (knight_pos.0 - j).abs() == 2 && (knight_pos.1 - k).abs() == 1 {
                count -= 1;
            } else if (knight_pos.0 - j).abs() == 1 && (knight_pos.1 - k).abs() == 2 {
                count -= 1;
            }
        }
    }

    println!("{:?}", count);
}


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 k: usize = scan.next();
    let mut arr: Vec<usize> = scan.next_n(12);
    arr.sort();
    arr.reverse();
    let mut index = 1;
    let mut acc = arr[0];
    while acc < k && index < 12 {
        acc += arr[index];
        index += 1;
    }
    if acc < k {
        println!("-1");
    } else if k == 0 {
        println!("0");
    } else {
        println!("{}", index);
    }
}

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


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

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

    let k = input.i();
    let mut a = input.vp::<i32>(12);
    a.sort();
    a.reverse();
    let sol = (|| {
        if k == 0 { return 0; }
        let mut sum = 0;
        for i in 0..12 {
            sum += a[i as usize];
            if sum >= k {
                return i + 1;
            }
        }
        -1
    })();
    println!("{}", sol);
}


use std::io;

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

	let mut l = String::new();
	io::stdin().read_line(&mut l).unwrap();
	let l: i32 = l.trim().parse().unwrap();

	let mut m = String::new();
	io::stdin().read_line(&mut m).unwrap();
	let m: i32 = m.trim().parse().unwrap();

	let mut n = String::new();
	io::stdin().read_line(&mut n).unwrap();
	let n: i32 = n.trim().parse().unwrap();

	let mut d = String::new();
	io::stdin().read_line(&mut d).unwrap();
	let d: i32 = d.trim().parse().unwrap();

	let mut ans = 0;
	for i in 1..=d {
		if i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0 {
			ans += 1;
		}
	}

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