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

fn get_vals<T>(count: usize) -> Vec<T> where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug {
    let mut val = String::new();
    stdin().read_line(&mut val).expect("Failed to read line");
    val.split_whitespace()
        .map(|x|
            x.parse::<T>().expect("Failed to parse value"))
        .take(count).collect()
}

pub fn mashmokh() {
    let mut ins = get_vals::<usize>(2);
    let (n, k) = (ins.remove(0), ins.remove(0));
    let mut dp = vec![vec![0 as usize; k]; n];
    for x in dp[0].iter_mut() {
        *x = 1;
    }
    for i in dp.iter_mut() {
        i[0] = 1;
    }
    for i in 1..dp.len() {
        for j in 1..dp[i].len() {
            dp[i][j] = factor(i + 1)
                .into_iter()
                .map(|x| dp[x - 1][j - 1])
                .sum()
        }
    }
    let ans: usize = dp.iter_mut().map(|x| x[k - 1]).sum();
    // for i in dp {
    //     for j in i {
    //         print!("{0: <2}", j);
    //     }
    //     println!();
    // }
    println!("{}", ans % 1000000007)
}

pub fn factor(input: usize) -> Vec<usize> {
    let mut vector = vec![];

    for count in 1..(input + 1) {
        if input % count == 0 {
            vector.push(count as usize);
        }
    }

    return vector;
}


use std::*;

fn main () {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let a: i32 = buf.parse();
    println!("1");
}


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

struct Reader {}

impl Reader {
    #[allow(unused)]
    fn read_string() -> String {
        let mut string: String = String::new();
        std::io::stdin().read_line(&mut string).unwrap();
        string.trim().to_string()
    }

    #[allow(unused)]
    fn read_tokens() -> Vec::<String> {
        let mut string: String = String::new();
        std::io::stdin().read_line(&mut string).unwrap();
        let mut v = Vec::new();
        for value in string.split_whitespace() {
            v.push(value.to_string());
        }
        v
    }
}

//mod math;

pub fn generate_simple_numbers(max_value: u64) -> Vec<u64> {
    let mut src = vec![true; max_value as usize + 1];
    let mut dst = Vec::new();

    for i in 2 .. max_value as usize + 1 {
        if src[i] {
            let mut ind = i * i;
            while ind <= max_value as usize {
                src[ind] = false;
                ind += i;
            }
            dst.push(i as u64);
        }
    }
    dst
}

fn main() {
    let n = Reader::read_string().parse::<i64>().unwrap();
    let simple_numbers = generate_simple_numbers(3000);
    let mut ans = 0_i64;
    for i in 1..=n {
        let mut number = i;
        let mut map = std::collections::BTreeSet::<i64>::new();
        for value in simple_numbers.iter() {
            if *value > number {
                break;
            }
            while number % *value == 0 {
                map.insert(*value);
                number /= *value;
            }
        }
        if map.len() == 2 {
            ans += 1;
        }
    }
    println!("{}", ans);
}


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

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let a = read::<String>()
        .chars()
        .map(|x| -(x.to_digit(36).unwrap() as i64 - 10))
        .collect::<Vec<_>>();
    let mut dp = vec![std::i64::MAX; n];
    let mut color = vec![0; n];
    for i in 0..n {
        let mut pointer = dp.lower_bound(&a[i]);
        dp[pointer] = a[i];
        color[i] = pointer;
    }
    if dp.lower_bound(&std::i64::MAX) <= 2 {
        println!("YES");
        for ch in color {
            print!("{}", ch);
        }
        println!("");
    } else {
        println!("NO");
    }
}

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

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

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

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


// Vicfred
// https://codeforces.com/problemset/problem/546/C

use std::io;
use std::collections::HashSet;
use std::collections::VecDeque;

#[derive(Debug,PartialEq,Eq,PartialOrd,Ord,Hash)]
struct Pair(i64, i64);

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

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

    let mut line = String::new();

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

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

    a.pop_front();

    let mut line = String::new();

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

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

    b.pop_front();

    let mut ans = 0;

    while !a.is_empty() && !b.is_empty() {
        ans += 1;

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

        let x = a.pop_front().unwrap();
        let y = b.pop_front().unwrap();

        states.insert(Pair(x,y));

        if x > y {
            a.push_back(y);
            a.push_back(x);
        } else {
            b.push_back(x);
            b.push_back(y);
        }
        if ans > 1000 {
            println!("-1");
            return;
        }
    }

    let winner = if a.is_empty() {2} else {1};

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


use std::fs::File;
use std::io::prelude::*;
use std::path::Path;

fn main() -> std::io::Result<()> {
    let mut file = File::open(Path::new("input.txt")).unwrap_or(| | {
		println!("Error");
	});
	let mut f = File::create(Path::new("output.txt"))?;
    let mut contents = String::new();
    file.read_to_string(&mut contents)?;
	let g: Vec<&str> = contents.split("\r\n").collect();
	let num:u32 = g[0].parse().unwrap();
	let v: Vec<&str> = g[1].split('W').collect();
	let mut size = 0;
	if v[v.len()-1].len()==0 {
		size=v.len()-1;
	} else {
		size=v.len();
	}
	let pr = format!("{}\n", size);
	f.write_all(pr.as_bytes())?;
	for index in 0..size {
		let pr = format!("{} ", v[index].len());
		f.write_all(pr.as_bytes())?;
	}
	Ok(())
}


fn read_int() -> u16 {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Failed");
    let x = input.trim().parse::<u16>().unwrap();
    x
}

fn read_int_vec() -> Vec<u16>{
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("read error");
    let mut vec = input.split_whitespace()
        .map(|i| i.parse::<u16>().expect("parse error"))
        .collect::<Vec<u16>>();
    vec
}

fn main() {

    let x = read_int() + 1;
    let vec = read_int_vec();
    let sum: u16 = vec.iter().sum();

    let mut total = 0;
    let mut range = 1..6;
    loop {
        match range.next() {
            Some(i) => {
                // println!("also: ({}+{}) % {} = {}", sum, i, x, (((sum+i) % x) + x)% x);
                if !((((sum+i) % x) + x) % x == 1){
                    // println!("====");
                    total = total + 1;
                }
            },
            None => { break }
        }
    }
    println!("}", total);

}


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

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

fn div_and_ceil(a: i32, b: i32) -> i32 {
    if a % b == 0 { a / b } else { a / b + 1 }
}

fn main() {
    let (guests, lists) = readln(i32, i32);

    let red = div_and_ceil(2 * guests, lists);
    let green = div_and_ceil(5 * guests, lists);
    let blue = div_and_ceil(8 * guests, lists);

    println!("{}", red + green + blue);
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;

bool f_possible(int x, vector<int> p) {
    int perm_count = 0;
    do {
        if ((((x % p[0]) % p[1]) % p[2]) % p[3] == x) {
            perm_count++;
        }
        if (perm_count >= 7) {
            return true;
        }
    }
    while (next_permutation(p.begin(), p.end()));
    return false;
}

int solve(const vector<int>& p, int a, int b) {
    int ans = 0;
    for (int x = a; x <= b; x++) {
        if (f_possible(x, p)) {
            ans++;
        }
    }
    return ans;
}

int main() {
    vector<int> p;
    for (int i = 0; i < 4; i++) {
        int x; cin >> x;
        p.push_back(x);
    }
    sort(p.begin(), p.end());
    int a, b;
    cin >> a >> b;
    int ans = solve(p, a, b);
    cout << ans << "\n";
}


#[allow(unused_imports)]
use std::io::{stdout, BufWriter, Write};
fn main() {
    let out = stdout();
    let mut out = BufWriter::new(out.lock());

    inputv! {
        t:usize,
    }
    ModInt::set_modulus(1_000_000_007);
    let mut dpf = DpFactorial::new();

    for _ in 0..t {
        inputv! {
            n:usize,k:usize,
        }
        let mut ans = ModInt::new(0);
        for q in 0..=k {
            ans += dpf.get_combination(k, q) * ModInt::new(n - 1).pow(q as u64);
        }
        writeln!(out, "{}", ans).unwrap();
    }
}

//https://github.com/rust-lang-ja/ac-library-rs
//https://github.com/manta1130/competitive-template-rs

use dpfactorial::*;
use modint::*;

pub mod dpfactorial {
    use crate::modint::*;

    #[derive(Default)]
    pub struct DpFactorial {
        normal: Vec<ModInt>,
        inv: Vec<ModInt>,
    }
    impl DpFactorial {
        #[allow(dead_code)]
        pub fn new() -> DpFactorial {
            let mut obj = DpFactorial {
                normal: Vec::new(),
                inv: Vec::new(),
            };
            obj.normal.push(ModInt::new(1));
            obj.inv.push(ModInt::new(1));
            obj
        }

        #[allow(dead_code)]
        pub fn get_factorial(&mut self, n: usize) -> ModInt {
            if n < self.normal.len() {
                return self.normal[n];
            }
            for z in self.normal.len()..n as usize + 1 {
                let buf = ModInt::new(z);
                let buf = buf * self.normal[z - 1];

                self.normal.push(buf);
            }
            self.normal[n]
        }

        #[allow(dead_code)]
        pub fn get_factorial_inv(&mut self, n: usize) -> ModInt {
            if n < self.inv.len() {
                return self.inv[n];
            }
            for z in self.inv.len()..n + 1 {
                let mut buf = ModInt::new(z);
                buf = buf.inv();
                let buf = buf * self.inv[z - 1];
                self.inv.push(buf);
            }
            self.inv[n]
        }

        #[allow(dead_code)]
        pub fn get_combination(&mut self, n: usize, r: usize) -> ModInt {
            if n < r {
                return ModInt::new(0);
            }
            self.get_factorial(n) * self.get_factorial_inv(n - r) * self.get_factorial_inv(r)
        }

        #[allow(dead_code)]
        pub fn get_permutation(&mut self, n: usize, r: usize) -> ModInt {
            if n < r {
                return ModInt::new(0);
            }
            self.get_factorial(n) * self.get_factorial_inv(n - r)
        }
    }
}
pub mod internal_math {
    #![allow(dead_code)]
    use std::mem::swap;

    /* const */
    pub(crate) fn safe_mod(mut x: i64, m: i64) -> i64 {
        x %= m;
        if x < 0 {
            x += m;
        }
        x
    }

    pub(crate) struct Barrett {
        pub(crate) _m: u32,
        pub(crate) im: u64,
    }

    impl Barrett {
        pub(crate) fn new(m: u32) -> Barrett {
            Barrett {
                _m: m,
                im: (-1i64 as u64 / m as u64).wrapping_add(1),
            }
        }

        pub(crate) fn umod(&self) -> u32 {
            self._m
        }

        #[allow(clippy::many_single_char_names)]
        pub(crate) fn mul(&self, a: u32, b: u32) -> u32 {
            mul_mod(a, b, self._m, self.im)
        }
    }

    #[allow(clippy::many_single_char_names)]
    pub(crate) fn mul_mod(a: u32, b: u32, m: u32, im: u64) -> u32 {
        let mut z = a as u64;
        z *= b as u64;
        let x = (((z as u128) * (im as u128)) >> 64) as u64;
        let mut v = z.wrapping_sub(x.wrapping_mul(m as u64)) as u32;
        if m <= v {
            v = v.wrapping_add(m);
        }
        v
    }

    /* const */
    #[allow(clippy::many_single_char_names)]
    pub(crate) fn pow_mod(x: i64, mut n: i64, m: i32) -> i64 {
        if m == 1 {
            return 0;
        }
        let _m = m as u32;
        let mut r: u64 = 1;
        let mut y: u64 = safe_mod(x, m as i64) as u64;
        while n != 0 {
            if (n & 1) > 0 {
                r = (r * y) % (_m as u64);
            }
            y = (y * y) % (_m as u64);
            n >>= 1;
        }
        r as i64
    }

    /* const */
    pub(crate) fn is_prime(n: i32) -> bool {
        let n = n as i64;
        match n {
            _ if n <= 1 => return false,
            2 | 7 | 61 => return true,
            _ if n % 2 == 0 => return false,
            _ => {}
        }
        let mut d = n - 1;
        while d % 2 == 0 {
            d /= 2;
        }
        for &a in &[2, 7, 61] {
            let mut t = d;
            let mut y = pow_mod(a, t, n as i32);
            while t != n - 1 && y != 1 && y != n - 1 {
                y = y * y % n;
                t <<= 1;
            }
            if y != n - 1 && t % 2 == 0 {
                return false;
            }
        }
        true
    }

    /* const */
    #[allow(clippy::many_single_char_names)]
    pub(crate) fn inv_gcd(a: i64, b: i64) -> (i64, i64) {
        let a = safe_mod(a, b);
        if a == 0 {
            return (b, 0);
        }

        let mut s = b;
        let mut t = a;
        let mut m0 = 0;
        let mut m1 = 1;

        while t != 0 {
            let u = s / t;
            s -= t * u;
            m0 -= m1 * u; // |m1 * u| <= |m1| * s <= b

            swap(&mut s, &mut t);
            swap(&mut m0, &mut m1);
        }
        if m0 < 0 {
            m0 += b / s;
        }
        (s, m0)
    }

    /* const */
    pub(crate) fn primitive_root(m: i32) -> i32 {
        match m {
            2 => return 1,
            167_772_161 => return 3,
            469_762_049 => return 3,
            754_974_721 => return 11,
            998_244_353 => return 3,
            _ => {}
        }

        let mut divs = [0; 20];
        divs[0] = 2;
        let mut cnt = 1;
        let mut x = (m - 1) / 2;
        while x % 2 == 0 {
            x /= 2;
        }
        for i in (3..std::i32::MAX).step_by(2) {
            if i as i64 * i as i64 > x as i64 {
                break;
            }
            if x % i == 0 {
                divs[cnt] = i;
                cnt += 1;
                while x % i == 0 {
                    x /= i;
                }
            }
        }
        if x > 1 {
            divs[cnt] = x;
            cnt += 1;
        }
        let mut g = 2;
        loop {
            if (0..cnt).all(|i| pow_mod(g, ((m - 1) / divs[i]) as i64, m) != 1) {
                break g as i32;
            }
            g += 1;
        }
    }
}
pub mod modint {

    use crate::internal_math;
    use std::{
        cell::RefCell,
        convert::{Infallible, TryInto as _},
        fmt,
        hash::{Hash, Hasher},
        iter::{Product, Sum},
        marker::PhantomData,
        ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign},
        str::FromStr,
        sync::atomic::{self, AtomicU32, AtomicU64},
        thread::LocalKey,
    };

    pub type ModInt1000000007 = StaticModInt<Mod1000000007>;
    pub type ModInt998244353 = StaticModInt<Mod998244353>;
    pub type ModInt = DynamicModInt<DefaultId>;

    #[derive(Copy, Clone, Eq, PartialEq)]
    #[repr(transparent)]
    pub struct StaticModInt<M> {
        val: u32,
        phantom: PhantomData<fn() -> M>,
    }

    impl<M: Modulus> StaticModInt<M> {
        #[inline(always)]
        pub fn modulus() -> u32 {
            M::VALUE
        }

        #[inline]
        pub fn new<T: RemEuclidU32>(val: T) -> Self {
            Self::raw(val.rem_euclid_u32(M::VALUE))
        }

        #[inline]
        pub fn raw(val: u32) -> Self {
            Self {
                val,
                phantom: PhantomData,
            }
        }

        #[inline]
        pub fn val(self) -> u32 {
            self.val
        }

        #[inline]
        pub fn pow(self, n: u64) -> Self {
            <Self as ModIntBase>::pow(self, n)
        }

        #[inline]
        pub fn inv(self) -> Self {
            if M::HINT_VALUE_IS_PRIME {
                if self.val() == 0 {
                    panic!("attempt to divide by zero");
                }
                debug_assert!(
                    internal_math::is_prime(M::VALUE.try_into().unwrap()),
                    "{} is not a prime number",
                    M::VALUE,
                );
                self.pow((M::VALUE - 2).into())
            } else {
                Self::inv_for_non_prime_modulus(self)
            }
        }
    }

    impl<M: Modulus> ModIntBase for StaticModInt<M> {
        #[inline(always)]
        fn modulus() -> u32 {
            Self::modulus()
        }

        #[inline]
        fn raw(val: u32) -> Self {
            Self::raw(val)
        }

        #[inline]
        fn val(self) -> u32 {
            self.val()
        }

        #[inline]
        fn inv(self) -> Self {
            self.inv()
        }
    }

    pub trait Modulus: 'static + Copy + Eq {
        const VALUE: u32;
        const HINT_VALUE_IS_PRIME: bool;

        fn butterfly_cache() -> &'static LocalKey<RefCell<Option<ButterflyCache<Self>>>>;
    }

    #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
    pub enum Mod1000000007 {}

    impl Modulus for Mod1000000007 {
        const VALUE: u32 = 1_000_000_007;
        const HINT_VALUE_IS_PRIME: bool = true;

        fn butterfly_cache() -> &'static LocalKey<RefCell<Option<ButterflyCache<Self>>>> {
            thread_local! {
                static BUTTERFLY_CACHE: RefCell<Option<ButterflyCache<Mod1000000007>>> = RefCell::default();
            }
            &BUTTERFLY_CACHE
        }
    }

    #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
    pub enum Mod998244353 {}

    impl Modulus for Mod998244353 {
        const VALUE: u32 = 998_244_353;
        const HINT_VALUE_IS_PRIME: bool = true;

        fn butterfly_cache() -> &'static LocalKey<RefCell<Option<ButterflyCache<Self>>>> {
            thread_local! {
                static BUTTERFLY_CACHE: RefCell<Option<ButterflyCache<Mod998244353>>> = RefCell::default();
            }
            &BUTTERFLY_CACHE
        }
    }

    pub struct ButterflyCache<M> {
        pub(crate) sum_e: Vec<StaticModInt<M>>,
        pub(crate) sum_ie: Vec<StaticModInt<M>>,
    }

    #[derive(Copy, Clone, Eq, PartialEq)]
    #[repr(transparent)]
    pub struct DynamicModInt<I> {
        val: u32,
        phantom: PhantomData<fn() -> I>,
    }

    impl<I: Id> DynamicModInt<I> {
        #[inline]
        pub fn modulus() -> u32 {
            I::companion_barrett().umod()
        }

        #[inline]
        pub fn set_modulus(modulus: u32) {
            if modulus == 0 {
                panic!("the modulus must not be 0");
            }
            I::companion_barrett().update(modulus);
        }

        #[inline]
        pub fn new<T: RemEuclidU32>(val: T) -> Self {
            <Self as ModIntBase>::new(val)
        }

        #[inline]
        pub fn raw(val: u32) -> Self {
            Self {
                val,
                phantom: PhantomData,
            }
        }

        #[inline]
        pub fn val(self) -> u32 {
            self.val
        }

        #[inline]
        pub fn pow(self, n: u64) -> Self {
            <Self as ModIntBase>::pow(self, n)
        }

        #[inline]
        pub fn inv(self) -> Self {
            Self::inv_for_non_prime_modulus(self)
        }
    }

    impl<I: Id> ModIntBase for DynamicModInt<I> {
        #[inline]
        fn modulus() -> u32 {
            Self::modulus()
        }

        #[inline]
        fn raw(val: u32) -> Self {
            Self::raw(val)
        }

        #[inline]
        fn val(self) -> u32 {
            self.val()
        }

        #[inline]
        fn inv(self) -> Self {
            self.inv()
        }
    }

    pub trait Id: 'static + Copy + Eq {
        fn companion_barrett() -> &'static Barrett;
    }

    #[derive(Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug)]
    pub enum DefaultId {}

    impl Id for DefaultId {
        fn companion_barrett() -> &'static Barrett {
            static BARRETT: Barrett = Barrett::default();
            &BARRETT
        }
    }

    pub struct Barrett {
        m: AtomicU32,
        im: AtomicU64,
    }

    impl Barrett {
        #[inline]
        pub const fn new(m: u32) -> Self {
            Self {
                m: AtomicU32::new(m),
                im: AtomicU64::new((-1i64 as u64 / m as u64).wrapping_add(1)),
            }
        }

        #[inline]
        const fn default() -> Self {
            Self::new(998_244_353)
        }

        #[inline]
        fn update(&self, m: u32) {
            let im = (-1i64 as u64 / m as u64).wrapping_add(1);
            self.m.store(m, atomic::Ordering::SeqCst);
            self.im.store(im, atomic::Ordering::SeqCst);
        }

        #[inline]
        fn umod(&self) -> u32 {
            self.m.load(atomic::Ordering::SeqCst)
        }

        #[inline]
        fn mul(&self, a: u32, b: u32) -> u32 {
            let m = self.m.load(atomic::Ordering::SeqCst);
            let im = self.im.load(atomic::Ordering::SeqCst);
            internal_math::mul_mod(a, b, m, im)
        }
    }

    impl Default for Barrett {
        #[inline]
        fn default() -> Self {
            Self::default()
        }
    }

    pub trait ModIntBase:
        Default
        + FromStr
        + From<i8>
        + From<i16>
        + From<i32>
        + From<i64>
        + From<i128>
        + From<isize>
        + From<u8>
        + From<u16>
        + From<u32>
        + From<u64>
        + From<u128>
        + From<usize>
        + Copy
        + Eq
        + Hash
        + fmt::Display
        + fmt::Debug
        + Neg<Output = Self>
        + Add<Output = Self>
        + Sub<Output = Self>
        + Mul<Output = Self>
        + Div<Output = Self>
        + AddAssign
        + SubAssign
        + MulAssign
        + DivAssign
    {
        fn modulus() -> u32;

        fn raw(val: u32) -> Self;

        fn val(self) -> u32;

        fn inv(self) -> Self;

        #[inline]
        fn new<T: RemEuclidU32>(val: T) -> Self {
            Self::raw(val.rem_euclid_u32(Self::modulus()))
        }

        #[inline]
        fn pow(self, mut n: u64) -> Self {
            let mut x = self;
            let mut r = Self::raw(1);
            while n > 0 {
                if n & 1 == 1 {
                    r *= x;
                }
                x *= x;
                n >>= 1;
            }
            r
        }
    }

    pub trait RemEuclidU32 {
        fn rem_euclid_u32(self, modulus: u32) -> u32;
    }

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

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

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

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

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

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

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

    #[cfg(target_pointer_width = "64")]
    impl_rem_euclid_u32_for_large_unsigned!(usize);

    trait InternalImplementations: ModIntBase {
        #[inline]
        fn inv_for_non_prime_modulus(this: Self) -> Self {
            let (gcd, x) = internal_math::inv_gcd(this.val().into(), Self::modulus().into());
            if gcd != 1 {
                panic!("the multiplicative inverse does not exist");
            }
            Self::new(x)
        }

        #[inline]
        fn default_impl() -> Self {
            Self::raw(0)
        }

        #[inline]
        fn from_str_impl(s: &str) -> Result<Self, Infallible> {
            Ok(s.parse::<i64>()
                .map(Self::new)
                .unwrap_or_else(|_| todo!("parsing as an arbitrary precision integer?")))
        }

        #[inline]
        fn hash_impl(this: &Self, state: &mut impl Hasher) {
            this.val().hash(state)
        }

        #[inline]
        fn display_impl(this: &Self, f: &mut fmt::Formatter) -> fmt::Result {
            fmt::Display::fmt(&this.val(), f)
        }

        #[inline]
        fn debug_impl(this: &Self, f: &mut fmt::Formatter) -> fmt::Result {
            fmt::Debug::fmt(&this.val(), f)
        }

        #[inline]
        fn neg_impl(this: Self) -> Self {
            Self::sub_impl(Self::raw(0), this)
        }

        #[inline]
        fn add_impl(lhs: Self, rhs: Self) -> Self {
            let modulus = Self::modulus();
            let mut val = lhs.val() + rhs.val();
            if val >= modulus {
                val -= modulus;
            }
            Self::raw(val)
        }

        #[inline]
        fn sub_impl(lhs: Self, rhs: Self) -> Self {
            let modulus = Self::modulus();
            let mut val = lhs.val().wrapping_sub(rhs.val());
            if val >= modulus {
                val = val.wrapping_add(modulus)
            }
            Self::raw(val)
        }

        fn mul_impl(lhs: Self, rhs: Self) -> Self;

        #[inline]
        fn div_impl(lhs: Self, rhs: Self) -> Self {
            Self::mul_impl(lhs, rhs.inv())
        }
    }

    impl<M: Modulus> InternalImplementations for StaticModInt<M> {
        #[inline]
        fn mul_impl(lhs: Self, rhs: Self) -> Self {
            Self::raw((u64::from(lhs.val()) * u64::from(rhs.val()) % u64::from(M::VALUE)) as u32)
        }
    }

    impl<I: Id> InternalImplementations for DynamicModInt<I> {
        #[inline]
        fn mul_impl(lhs: Self, rhs: Self) -> Self {
            Self::raw(I::companion_barrett().mul(lhs.val, rhs.val))
        }
    }

    macro_rules! impl_basic_traits {
    () => {};
    (impl <$generic_param:ident : $generic_param_bound:tt> _ for $self:ty; $($rest:tt)*) => {
        impl <$generic_param: $generic_param_bound> Default for $self {
            #[inline]
            fn default() -> Self {
                Self::default_impl()
            }
        }

        impl <$generic_param: $generic_param_bound> FromStr for $self {
            type Err = Infallible;

            #[inline]
            fn from_str(s: &str) -> Result<Self, Infallible> {
                Self::from_str_impl(s)
            }
        }

        impl<$generic_param: $generic_param_bound, V: RemEuclidU32> From<V> for $self {
            #[inline]
            fn from(from: V) -> Self {
                Self::new(from)
            }
        }

        #[allow(clippy::derive_hash_xor_eq)]
        impl<$generic_param: $generic_param_bound> Hash for $self {
            #[inline]
            fn hash<H: Hasher>(&self, state: &mut H) {
                Self::hash_impl(self, state)
            }
        }

        impl<$generic_param: $generic_param_bound> fmt::Display for $self {
            #[inline]
            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                Self::display_impl(self, f)
            }
        }

        impl<$generic_param: $generic_param_bound> fmt::Debug for $self {
            #[inline]
            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                Self::debug_impl(self, f)
            }
        }

        impl<$generic_param: $generic_param_bound> Neg for $self {
            type Output = $self;

            #[inline]
            fn neg(self) -> $self {
                Self::neg_impl(self)
            }
        }

        impl<$generic_param: $generic_param_bound> Neg for &'_ $self {
            type Output = $self;

            #[inline]
            fn neg(self) -> $self {
                <$self>::neg_impl(*self)
            }
        }

        impl_basic_traits!($($rest)*);
    };
}

    impl_basic_traits! {
        impl <M: Modulus> _ for StaticModInt<M> ;
        impl <I: Id     > _ for DynamicModInt<I>;
    }

    macro_rules! impl_bin_ops {
    () => {};
    (for<$($generic_param:ident : $generic_param_bound:tt),*> <$lhs_ty:ty> ~ <$rhs_ty:ty> -> $output:ty { { $lhs_body:expr } ~ { $rhs_body:expr } } $($rest:tt)*) => {
        impl <$($generic_param: $generic_param_bound),*> Add<$rhs_ty> for $lhs_ty {
            type Output = $output;

            #[inline]
            fn add(self, rhs: $rhs_ty) -> $output {
                <$output>::add_impl(apply($lhs_body, self), apply($rhs_body, rhs))
            }
        }

        impl <$($generic_param: $generic_param_bound),*> Sub<$rhs_ty> for $lhs_ty {
            type Output = $output;

            #[inline]
            fn sub(self, rhs: $rhs_ty) -> $output {
                <$output>::sub_impl(apply($lhs_body, self), apply($rhs_body, rhs))
            }
        }

        impl <$($generic_param: $generic_param_bound),*> Mul<$rhs_ty> for $lhs_ty {
            type Output = $output;

            #[inline]
            fn mul(self, rhs: $rhs_ty) -> $output {
                <$output>::mul_impl(apply($lhs_body, self), apply($rhs_body, rhs))
            }
        }

        impl <$($generic_param: $generic_param_bound),*> Div<$rhs_ty> for $lhs_ty {
            type Output = $output;

            #[inline]
            fn div(self, rhs: $rhs_ty) -> $output {
                <$output>::div_impl(apply($lhs_body, self), apply($rhs_body, rhs))
            }
        }

        impl_bin_ops!($($rest)*);
    };
}

    macro_rules! impl_assign_ops {
    () => {};
    (for<$($generic_param:ident : $generic_param_bound:tt),*> <$lhs_ty:ty> ~= <$rhs_ty:ty> { _ ~= { $rhs_body:expr } } $($rest:tt)*) => {
        impl <$($generic_param: $generic_param_bound),*> AddAssign<$rhs_ty> for $lhs_ty {
            #[inline]
            fn add_assign(&mut self, rhs: $rhs_ty) {
                *self = *self + apply($rhs_body, rhs);
            }
        }

        impl <$($generic_param: $generic_param_bound),*> SubAssign<$rhs_ty> for $lhs_ty {
            #[inline]
            fn sub_assign(&mut self, rhs: $rhs_ty) {
                *self = *self - apply($rhs_body, rhs);
            }
        }

        impl <$($generic_param: $generic_param_bound),*> MulAssign<$rhs_ty> for $lhs_ty {
            #[inline]
            fn mul_assign(&mut self, rhs: $rhs_ty) {
                *self = *self * apply($rhs_body, rhs);
            }
        }

        impl <$($generic_param: $generic_param_bound),*> DivAssign<$rhs_ty> for $lhs_ty {
            #[inline]
            fn div_assign(&mut self, rhs: $rhs_ty) {
                *self = *self / apply($rhs_body, rhs);
            }
        }

        impl_assign_ops!($($rest)*);
    };
}

    #[inline]
    fn apply<F: FnOnce(X) -> O, X, O>(f: F, x: X) -> O {
        f(x)
    }

    impl_bin_ops! {
        for<M: Modulus> <StaticModInt<M>     > ~ <StaticModInt<M>     > -> StaticModInt<M>  { { |x| x  } ~ { |x| x  } }
        for<M: Modulus> <StaticModInt<M>     > ~ <&'_ StaticModInt<M> > -> StaticModInt<M>  { { |x| x  } ~ { |&x| x } }
        for<M: Modulus> <&'_ StaticModInt<M> > ~ <StaticModInt<M>     > -> StaticModInt<M>  { { |&x| x } ~ { |x| x  } }
        for<M: Modulus> <&'_ StaticModInt<M> > ~ <&'_ StaticModInt<M> > -> StaticModInt<M>  { { |&x| x } ~ { |&x| x } }
        for<I: Id     > <DynamicModInt<I>    > ~ <DynamicModInt<I>    > -> DynamicModInt<I> { { |x| x  } ~ { |x| x  } }
        for<I: Id     > <DynamicModInt<I>    > ~ <&'_ DynamicModInt<I>> -> DynamicModInt<I> { { |x| x  } ~ { |&x| x } }
        for<I: Id     > <&'_ DynamicModInt<I>> ~ <DynamicModInt<I>    > -> DynamicModInt<I> { { |&x| x } ~ { |x| x  } }
        for<I: Id     > <&'_ DynamicModInt<I>> ~ <&'_ DynamicModInt<I>> -> DynamicModInt<I> { { |&x| x } ~ { |&x| x } }

        for<M: Modulus, T: RemEuclidU32> <StaticModInt<M>     > ~ <T> -> StaticModInt<M>  { { |x| x  } ~ { StaticModInt::<M>::new } }
        for<I: Id     , T: RemEuclidU32> <DynamicModInt<I>    > ~ <T> -> DynamicModInt<I> { { |x| x  } ~ { DynamicModInt::<I>::new } }
    }

    impl_assign_ops! {
        for<M: Modulus> <StaticModInt<M> > ~= <StaticModInt<M>     > { _ ~= { |x| x  } }
        for<M: Modulus> <StaticModInt<M> > ~= <&'_ StaticModInt<M> > { _ ~= { |&x| x } }
        for<I: Id     > <DynamicModInt<I>> ~= <DynamicModInt<I>    > { _ ~= { |x| x  } }
        for<I: Id     > <DynamicModInt<I>> ~= <&'_ DynamicModInt<I>> { _ ~= { |&x| x } }

        for<M: Modulus, T: RemEuclidU32> <StaticModInt<M> > ~= <T> { _ ~= { StaticModInt::<M>::new } }
        for<I: Id,      T: RemEuclidU32> <DynamicModInt<I>> ~= <T> { _ ~= { DynamicModInt::<I>::new } }
    }

    macro_rules! impl_folding {
    () => {};
    (impl<$generic_param:ident : $generic_param_bound:tt> $trait:ident<_> for $self:ty { fn $method:ident(_) -> _ { _($unit:expr, $op:expr) } } $($rest:tt)*) => {
        impl<$generic_param: $generic_param_bound> $trait<Self> for $self {
            #[inline]
            fn $method<S>(iter: S) -> Self
            where
                S: Iterator<Item = Self>,
            {
                iter.fold($unit, $op)
            }
        }

        impl<'a, $generic_param: $generic_param_bound> $trait<&'a Self> for $self {
            #[inline]
            fn $method<S>(iter: S) -> Self
            where
                S: Iterator<Item = &'a Self>,
            {
                iter.fold($unit, $op)
            }
        }

        impl_folding!($($rest)*);
    };
}

    impl_folding! {
        impl<M: Modulus> Sum<_>     for StaticModInt<M>  { fn sum(_)     -> _ { _(Self::raw(0), Add::add) } }
        impl<M: Modulus> Product<_> for StaticModInt<M>  { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } }
        impl<I: Id     > Sum<_>     for DynamicModInt<I> { fn sum(_)     -> _ { _(Self::raw(0), Add::add) } }
        impl<I: Id     > Product<_> for DynamicModInt<I> { fn product(_) -> _ { _(Self::raw(1), Mul::mul) } }
    }
}


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

    let numbers_str = numbers_str.trim();

    let n: i32 = n_str.trim_end().parse().unwrap();

    let mut result = n / 11;

    let mut has_8_count = 0;

    for (_, c) in numbers_str.chars().enumerate(){
        if c == '8'{
            has_8_count += 1;
        }
    }

    if has_8_count < result {
        result = has_8_count;
    }

    println!("{}", result);

}


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

const NAMES: [&str; 5] = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];

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

    let mut cnt = 1;
    let mut total_len = 0;
    while total_len + cnt * 5 <= n {
        total_len += cnt * 5;
        cnt *= 2;
    }

    n -= total_len;
    n /= cnt;

    println!("{}", NAMES[n as usize]);
}


fn readln() -> Vec<i32> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}
fn main() {
    let input = readln();
    let mut n = input[0] - 1;

    static NAMES: [&str; 5] = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];

    let mut cnt = 1;
    let mut total_len = 0;
    while total_len + cnt * 5 <= n {
        total_len += cnt * 5;
        cnt *= 2;
    }

    n -= total_len;
    n /= cnt;

    println!("{}", NAMES[n as usize]);
}


fn readln() -> Vec<i32> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}
fn main() {
    let input = readln();
    let mut n = input[0] - 1;

    const NAMES: [&str; 5] = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];

    let mut cnt = 1;
    let mut total_len = 0;
    while total_len + cnt * 5 <= n {
        total_len += cnt * 5;
        cnt *= 2;
    }

    n -= total_len;
    n /= cnt;

    println!("{}", NAMES[n as usize]);
}


use std::io::{self, BufRead, Write};
use std::num::Wrapping;
use std::collections::{HashMap, HashSet};

const H1: Wrapping<u64> = Wrapping(327832409582091329);
const H2: Wrapping<u64> = Wrapping(234957239841289312);

#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
struct Variable([u8; 4]);
const RES_VAR: Variable = Variable([b'r', b'e', b's', 0]);

impl Variable {
    fn hash(&self) -> Wrapping<u64> {
        let mut hash = H1;
        for v in self.0.iter() {
            hash = (hash + Wrapping(*v as u64)) * H2;
        }
        hash
    }
}

fn is_char(s: u8) -> bool {
    match s {
        b'a' ... b'z' => true,
        b'A' ... b'Z' => true,
        b'0' ... b'9' => true,
        _ => false,
    }
}

fn read_var(s: &[u8]) -> (Variable, &[u8]) {
    let mut var = Variable([0; 4]);
    let mut i = 0;
    while i < s.len() && is_char(s[i]) {
        var.0[i] = s[i];
        i += 1;
    }
    (var, &s[i..])
}

#[derive(Clone, Copy)]
enum Data {
    Input(Variable),
    Op(Wrapping<u64>, u8, Wrapping<u64>),
}

impl Data {
    fn hash(&self) -> Wrapping<u64> {
        match self {
            Data::Input(v) => v.hash(),
            Data::Op(a, op, b) => {
                let op = Wrapping(*op as u64);
                (a * H2 + H1 + op) * H2 + b
            },
        }
    }
}

enum Command {
    Assign(Variable, Variable),
    Op(Variable, Variable, u8, Variable),
}

impl Command {
    fn parse(s: &[u8]) -> Command {
        let (lvar, s) = read_var(&s);
        let (var1, s) = read_var(&s[1..]);
        if s.len() == 0 || !is_op(s[0]) {
            Command::Assign(lvar, var1)
        } else {
            let op = s[0];
            let (var2, _) = read_var(&s[1..]);
            Command::Op(lvar, var1, op, var2)
        }
    }

    fn print(&self) -> io::Result<()> {
        let stdout = io::stdout();
        let mut stdout = stdout.lock();
        match self {
            Command::Assign(lvar, var1) => {
                stdout.write_all(&lvar.0)?;
                stdout.write_all(b"=")?;
                stdout.write_all(&var1.0)?;
                stdout.write_all(b"\n")?;
                Ok(())
            },
            Command::Op(lvar, var1, op, var2) => {
                stdout.write_all(&lvar.0)?;
                stdout.write_all(b"=")?;
                stdout.write_all(&var1.0)?;
                stdout.write_all(&[*op])?;
                stdout.write_all(&var2.0)?;
                stdout.write_all(b"\n")?;
                Ok(())
            },
        }
    }
}

fn is_op(s: u8) -> bool {
    match s {
        b'$' | b'^' | b'#' | b'&' => true,
        _ => false,
    }
}

struct VariableContext {
    vars: HashMap<Variable, Wrapping<u64>>,
    data: HashMap<Wrapping<u64>, Data>,
    input_vars: HashSet<Variable>,
}

impl VariableContext {
    fn new() -> Self {
        Self {
            vars: HashMap::new(),
            data: HashMap::new(),
            input_vars: HashSet::new(),
        }
    }

    fn hash_data(&mut self, data: Data) -> Wrapping<u64> {
        let hash = data.hash();
        self.data.entry(hash).or_insert(data);
        hash
    }

    fn get_var(&mut self, var: Variable) -> Wrapping<u64> {
        match self.vars.get(&var) {
            None => {
                self.input_vars.insert(var);
                self.hash_data(Data::Input(var))
            },
            Some(data) => *data,
        }
    }

    fn set_var(&mut self, var: Variable, data: Wrapping<u64>) {
        self.vars.insert(var, data);
    }
}

struct OutputContext {
    used_vars: HashSet<Variable>,
    data: HashMap<Wrapping<u64>, Data>,
    names: HashMap<Wrapping<u64>, Variable>,
    cur_name: i64,
    out: Vec<Command>,
}

impl OutputContext {
    fn new(ctx: VariableContext) -> Self {
        let VariableContext { vars: _, data, input_vars: used_vars } = ctx;
        Self {
            used_vars: used_vars,
            data: data,
            names: HashMap::new(),
            cur_name: 0,
            out: Vec::new(),
        }
    }

    fn new_name(&mut self) -> Variable {
        loop {
            let mut v = Variable([0; 4]);
            let mut cur = self.cur_name;
            self.cur_name += 1;
            for i in 0..4 {
                v.0[i] = (cur % 26) as u8 + b'a';
                cur /= 26;
            }
            if !self.used_vars.contains(&v) {
                return v;
            }
        }
    }

    fn make_var(&mut self, data: Wrapping<u64>) -> Variable {
        match self.names.get(&data) {
            Some(v) => *v,
            None => {
                let x = *(self.data.get(&data).unwrap());
                match x {
                    Data::Input(v) => v,
                    Data::Op(a, op, b) => {
                        let var = self.new_name();
                        let var1 = self.make_var(a);
                        let var2 = self.make_var(b);
                        self.out.push(Command::Op(var, var1, op, var2));
                        self.names.insert(data, var);
                        var
                    }
                }
            },
        }
    }

    fn output_result(&mut self, res: Wrapping<u64>) {
        let data = *(self.data.get(&res).unwrap());
        match data {
            Data::Input(v) => {
                if v != RES_VAR {
                    self.out.push(Command::Assign(RES_VAR, v));
                }
            },
            Data::Op(a, op, b) => {
                let var1 = self.make_var(a);
                let var2 = self.make_var(b);
                self.out.push(Command::Op(RES_VAR, var1, op, var2));
            }
        }
    }
}

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let n = lines.next().unwrap().unwrap().trim().parse::<usize>().unwrap();
    let mut context = VariableContext::new();
    for line in lines.take(n) {
        let cmd = Command::parse(line.unwrap().as_bytes());
        match cmd {
            Command::Assign(lvar, rvar) => {
                let data = context.get_var(rvar);
                context.set_var(lvar, data);
            },
            Command::Op(lvar, a, op, b) => {
                let x = context.get_var(a);
                let y = context.get_var(b);
                let h = context.hash_data(Data::Op(x, op, y));
                context.set_var(lvar ,h);
            },
        }
    }
    let res = context.get_var(RES_VAR);
    let mut context = OutputContext::new(context);
    context.output_result(res);
    println!("{}", context.out.len());
    for entry in context.out.into_iter() {
        entry.print().unwrap();
    }
}


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

fn main() -> () {
    let mut buffer = String::new();
    let stdin = io::stdin();
    let mut handle = stdin.lock();

    handle.read_to_string(&mut buffer).expect("stdin");

    let arr : Vec<_> = buffer.split_whitespace().map(|x| x.parse::<i64>().unwrap() ).collect();

    let mut n = arr.iter().nth(0).unwrap();

    let mut curr = 1;
    let mut total = 0;
    let mut count = 0;

    while total < n {
        count += 1;
        total +=  curr;
        curr = curr * 2;
    }

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


fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get { () => (get().parse().unwrap()) }

    let f0 = b"What are you doing at the end of the world? Are you busy? Will you save us?";
    let f1a = b"What are you doing while sending \"";
    let f1b = b"\"? Are you busy? Will you send \"";
    let f1c = b"\"?";

    let mut w = vec![0_u64; 100001];

    w[0] = f0.len() as u64;
    for i in 1..w.len() {
        w[i] = w[i-1] * 2 + (f1a.len() + f1b.len() + f1c.len()) as u64;
    }

    let q = get!();
    let mut v = vec![];
    for _ in 0..q {
        let mut n: usize = get!();
        let mut k: u64 = get!();
        k -= 1;
        loop {
            if k > w[n] {
                v.push(b'.');
                break;
            } else if n == 0 {
                v.push(f0[k as usize]);
                break;
            } else {
                n -= 1;
                if k < f1a.len() as u64 {
                    v.push(f1a[k as usize]);
                    break;
                }
                k -= f1a.len() as u64;
                if k < w[n] {
                    continue;
                }
                k -= w[n];
                if k < f1b.len() as u64 {
                    v.push(f1b[k as usize]);
                    break;
                }
                k -= f1b.len() as u64;
                if k < w[n] {
                    continue;
                }
                k -= w[n];
                if k < f1c.len() as u64 {
                    v.push(f1c[k as usize]);
                    break;
                }
                v.push(b'.');
                break;
            }
        }
    }
    println!("{}", String::from_utf8(v).unwrap());
}


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

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

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

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

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

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

fn f(i: usize, k: u64, ll: &Vec<u64>) -> char {
    let mut i = i;
    let mut k = k;

    loop {
        if i == 0 {
            let f0 = "What are you doing at the end of the world? Are you busy? Will you save us?";
            return if f0.len() as u64 > k {
                f0.chars().nth(k as usize).unwrap()
            } else {
                '.'
            };
        } else {
            if k < 34 {
                let s1 = "What are you doing while sending \"";
                return s1.chars().nth(k as usize).unwrap();
            } else if k < 34 + ll[i - 1] {
                // f(i - 1, k - 34, ll)
                i -= 1;
                k -= 34;
            } else if k < 34 + ll[i - 1] + 32 {
                let s2 = "\"? Are you busy? Will you send \"";
                return s2.chars().nth((k - 34 - ll[i - 1]) as usize).unwrap();
            } else if k < 34 + ll[i - 1] + 32 + ll[i - 1] {
                // f(i - 1, k - 34 - ll[i - 1] - 32, ll)
                k -= 34 + ll[i - 1] + 32;
                i -= 1;
            } else if k < 34 + ll[i - 1] + 32 + ll[i - 1] + 2 {
                let s3 = "\"?";
                return s3.chars()
                    .nth((k - 34 - ll[i - 1] - 32 - ll[i - 1]) as usize)
                    .unwrap();
            } else {
                return '.';
            }
        }
    }

}

fn main() {
    let k_max: u64 = 1000000000000000000;

    let mut ll = Vec::new();
    ll.push(75u64);
    let mut n = 0;
    for i in 1..100001 {
        n = ll[i - 1] * 2 + 68;
        ll.push(n);
        if n > k_max {
            break;
        }
    }
    while ll.len() < 100001 {
        ll.push(n);
    }

    let mut ans = Vec::new();

    let n = get!(usize);

    for _ in 0..n {
        let (n, k) = get!(usize, u64);
        ans.push(f(n, k - 1, &ll));
    }

    println!("{}", ans.into_iter().collect::<String>());
}


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 (a, b) = parse_line!(u64, u64);
    let mut pos = 0;
    let mut count = 0;
    while pos != a * b {
        let closest_a = (pos / a + 1) * a;
        let closest_b = (pos / b + 1) * b;
        if closest_a < closest_b {
            count += closest_a - pos;
            pos = closest_a;
        }else if closest_b < closest_a {
            pos = closest_b;
        }else if closest_a == closest_b {
            if a > b {
                count += closest_a - pos;
            }
            pos = closest_a;
        }
    }
    if count * 2 == a * b {
        println!("Equal");
    }else if count * 2 > a * b {
        println!("Dasha");
    }else{
        println!("Masha");
    }
}

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


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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($format:expr) => (write!(out,$format).unwrap());
        ($format:expr, $($args:expr),+) => (write!(out,$format,$($args),*).unwrap())
    }
    input! {
        n: usize,
        p: i64,
        s: [chars; n],
    }
    let mut a = 0;
    let mut tot = 0;
    for i in (0 .. n).rev() {
        if s[i] == "halfplus".chars().collect::<Vec<_>>() {
            a = 2 * a + 1;
            tot += a;
        } else {
            a *= 2;
            tot += a;
        }
    }
    puts!("{}\n", tot * (p / 2));
}

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


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

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter};
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = [$(&stringify!([$arg]:), &$arg as &Debug),*];
            stderr().write_fmt(format_args!("{:#?}\n", entries)).unwrap();
        }
    };
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn is_vowel(c: char) -> bool {
    match c {
        'a' | 'i' | 'u' | 'e' | 'o' => true,
        _ => false,
    }
}

pub fn main() {
    let S = rl().chars().vec();

    let mut ok = true;
    for i in 0..S.len() {
        if S[i] == 'n' || is_vowel(S[i]) || (i + 1 < S.len() && is_vowel(S[i + 1])) {
            continue;
        }

        ok = false;
        break;
    }

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


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

//

use std::cmp::*;

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

fn main() {
    run();
}


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

//

use std::cmp::*;

fn run() {
    input! {
        n: usize,
        p: [(chars, i32, i32); n],
    }
    let p = p
        .into_iter()
        .map(|p| ((p.0[0] == 'B') as usize, p.1, p.2))
        .collect::<Vec<_>>();
    let mut sum = vec![([0, 0], 0, 0)];
    for &(x, y, z) in p.iter() {
        for i in 0..sum.len() {
            let (mut a, mut b, mut c) = sum[i];
            a[x] += 1;
            b += y;
            c += z;
            sum.push((a, b, c));
        }
    }
    let inf = std::i32::MAX / 2;
    let mut now = vec![(0, 0, 0, 0)];// bit, Rのヒット、Bのヒット、最小値
    for _ in 0..n {
        let mut next = std::collections::BTreeMap::new();
        for (bit, x, y, v) in now {
//            println!("{} {} {} {}", bit, x, y, v);
            let rem_a = v - sum[bit].1 + x;
            let rem_b = v - sum[bit].2 + y;
            for (i, &(_, a, b)) in p.iter().enumerate() {
                if bit >> i & 1 == 1 {
                    continue;
                }
                let mut x = x;
                let mut y = y;
                let mut add = 0;
                let mut p = max(0, a - rem_a);
                if p > 0 {
                    x += std::cmp::min(p, sum[bit].0[0]);
                    p -= sum[bit].0[0];
                }
                add = max(add, p);
                let mut p = max(0, b - rem_b);
                if p > 0 {
                    y += std::cmp::min(p, sum[bit].0[1]);
                    p -= sum[bit].0[1];
                }
                add = max(add, p);
                let v = v + add;
                let po = next.entry((bit | (1 << i), x, y)).or_insert(v);
                *po = std::cmp::min(*po, v);
            }
        }
        let mut a = vec![];
        for ((bit, x, y), v) in next {
            a.push((bit, x, y, v));
        }
        now = a;
    }
    let ans = now.into_iter().map(|p| p.3).min().unwrap() + n as i32;
    println!("{}", ans);
}

fn main() {
    run();
}


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


use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;
use std::cmp::*;
use std::thread;
const INF: i64 = 1i64 << 60;
fn exec() {
    let mut sc = Scanner::new();
    let n: usize = sc.ne();
    let mut cards = Vec::new();
    for _ in 0..n {
        let c: String = sc.ne();
        let r: i64 = sc.ne();
        let b: i64 = sc.ne();
        let is_r = c == "R";
        cards.push((is_r, r, b));
    }
    let sn = 1 << n;
    let rn = n * (n + 1) / 2;
    let mut dp = vec![vec![-INF; rn]; sn];
    dp[0][0] = 0;
    for s in 0..sn {
        let mut rnum = 0;
        let mut bnum = 0;
        for i in 0..n {
            if (s >> i) & 1 == 0 {
                continue;
            }
            if cards[i].0 {
                rnum += 1;
            } else {
                bnum += 1;
            }
        }
        for i in 0..rn {
            // println!("{:b}, i: {}, {}", s, i, dp[s][i]);
            if dp[s][i] == -INF {
                continue;
            }
            for j in 0..n {
                if (s >> j) & 1 == 1 {
                    continue;
                }
                let ns = s | (1 << j);
                let ni = min(rnum, cards[j].1) as usize + i;
                dp[ns][ni] = max(dp[ns][ni], dp[s][i] + min(bnum, cards[j].2));
            }
        }
    }
    let rsum = cards.iter().fold(0, |acc, &t| acc + t.1);
    let bsum = cards.iter().fold(0, |acc, &t| acc + t.2);
    let mut ans = INF;
    for i in 0..rn {
        ans = min(ans, max(rsum - i as i64, bsum - dp[sn - 1][i]));
        // println!("{}", ans);
    }
    println!("{}", ans + n as i64);
}

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

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

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


//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 + 1);
            v.chmin(n - 1);
        }
    }
    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 sup = (n - 1) * (n - 1);
    let mut dp = vec![vec![vec![inf; 1 << n]; sup + 1]; 2];
    let abs = (need[1] - need[0]).abs() as usize;
    dp[(need[0] >= need[1]) as usize][min(sup, abs)][0] = 0;
    for bit in 0..(1 << n) {
        let sum = sum[bit];
        for rem in 0..=sup {
            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, sup)][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, sup)][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();
}


#![allow(unused_imports)]
use std::io::{BufReader, BufWriter, stdin, stdout, Write};
use std::cmp::{min, max};
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet, BinaryHeap};

const m:i64 = 1000000007;

fn main() {
	let mut inp = Iinput::default();
	let out = &mut BufWriter::new(stdout());
	let n:usize = inp.scan::<usize>();
	let k:i64 = inp.scan::<i64>();
	let mut nCr = vec![vec![0 as i64; n + 1]; n + 1];
	nCr[0][0] = 1;
	for i in 1..n+1 {
		for j in 0..i+1 {
			if j > 0 {
				nCr[i][j] += nCr[i - 1][j - 1];
			}
			if j < i {
				nCr[i][j] += nCr[i - 1][j];
			}
			nCr[i][j] %= m;
		}
	}
	let mut dp = vec![0; n + 1];
	dp[0] = 1;
	let mut pow2 = vec![1 as i64; n + 1];
	for i in 1..n+1 {
		pow2[i] = pow2[i - 1] * (k - 1) % m;
	}
	for _row in 0..n {
		let mut tp = vec![0; n + 1];
		let mut powa = 1 as i64;
		for i in 0..n+1 {
			for j in i..n+1 {
				let mut val = pow2[n - j] * powa % m;
				if i == j {
					val += m - pow2[n];
				}
				val = val * nCr[n - i][n - j] % m;
				tp[j] = (tp[j] + val * dp[i]) % m;
			}
			powa = powa * k % m;
		}
		dp = tp;
	}
	writeln!(out, "{}", dp[n]);
}

#[derive(Default)]
struct Iinput {
	buffer: Vec<String>
}

impl Iinput {
	fn scan<T: std::str::FromStr>(&mut self) -> T {
		loop {
			if let Some(token) = self.buffer.pop() {
				return token.parse().ok().expect("Parsing Error");
			}
			let mut s = String::new();
			stdin().read_line(&mut s).expect("Reading Error");
			self.buffer = s.split_whitespace().rev().map(String::from).collect();
		}
	}
}


// ---------- begin ModInt ----------
const MOD: u32 = 1_000_000_007;

#[derive(Clone, Copy)]
struct ModInt(u32);

impl std::ops::Add for ModInt {
    type Output = ModInt;
    fn add(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::AddAssign for ModInt {
    fn add_assign(&mut self, rhs: ModInt) {
        *self = *self + rhs;
    }
}

impl std::ops::Sub for ModInt {
    type Output = ModInt;
    fn sub(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + MOD - rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::SubAssign for ModInt {
    fn sub_assign(&mut self, rhs: ModInt) {
        *self = *self - rhs;
    }
}

impl std::ops::Mul for ModInt {
    type Output = ModInt;
    fn mul(self, rhs: ModInt) -> Self::Output {
        ModInt((self.0 as u64 * rhs.0 as u64 % MOD as u64) as u32)
    }
}

impl std::ops::MulAssign for ModInt {
    fn mul_assign(&mut self, rhs: ModInt) {
        *self = *self * rhs;
    }
}

impl std::ops::Neg for ModInt {
    type Output = ModInt;
    fn neg(self) -> Self::Output {
        ModInt(if self.0 == 0 {0} else {MOD - self.0})
    }
}

/*
impl std::fmt::Display for ModInt {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}
*/

#[allow(dead_code)]
impl ModInt {
    pub fn new(n: u32) -> ModInt {
        ModInt(n % MOD)
    }
    pub fn zero() -> ModInt {
        ModInt(0)
    }
    pub fn one() -> ModInt {
        ModInt(1)
    }
    pub fn pow(self, mut n: u32) -> ModInt {
        let mut t = ModInt::one();
        let mut s = self;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        t
    }
    pub fn inv(self) -> ModInt {
        self.pow(MOD - 2)
    }
    pub fn comb(n: u32, k: u32) -> ModInt {
        if k > n {
            return ModInt::zero();
        }
        let k = std::cmp::min(k, n - k);
        let mut nu = ModInt::one();
        let mut de = ModInt::one();
        for i in 0..k {
            nu *= ModInt(n - i);
            de *= ModInt(i + 1);
        }
        nu * de.inv()
    }
}

#[allow(dead_code)]
struct Precalc {
    inv: Vec<ModInt>,
    fact: Vec<ModInt>,
    ifact: Vec<ModInt>,
}

#[allow(dead_code)]
impl Precalc {
    pub fn new(n: usize) -> Precalc {
        let mut inv = vec![ModInt::one(); n + 1];
        let mut fact = vec![ModInt::one(); n + 1];
        let mut ifact = vec![ModInt::one(); n + 1];
        for i in 2..(n + 1) {
            inv[i] = -inv[MOD as usize % i] * ModInt(MOD / i as u32);
            fact[i] = fact[i - 1] * ModInt(i as u32);
            ifact[i] = ifact[i - 1] * inv[i];
        }
        Precalc {
            inv: inv,
            fact: fact,
            ifact: ifact,
        }
    }
    pub fn inv(&self, n: usize) -> ModInt {
        self.inv[n]
    }
    pub fn fact(&self, n: usize) -> ModInt {
        self.fact[n]
    }
    pub fn ifact(&self, n: usize) -> ModInt {
        self.ifact[n]
    }
    pub fn comb(&self, n: usize, k: usize) -> ModInt {
        if k > n {
            return ModInt::zero();
        }
        self.fact[n] * self.ifact[k] * self.ifact[n - k]
    }
}
// ---------- end ModInt ----------
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

// ここまで

fn run() {
    input! {
        n: usize,
        k: u32,
    }
    let mut ans = ModInt::zero();
    let pc = Precalc::new(n);
    for i in 0..=n {
        for j in 0..=n {
            let v = (n - i) * (n - j);
            let way = ModInt(k).pow(v as u32) * ModInt(k - 1).pow((n * n - v) as u32);
            ans += ModInt(MOD - 1).pow((i + j) as u32) * pc.comb(n, i) * pc.comb(n, j) * way;
        }
    }
    println!("{}", ans.0);
}

fn main() {
    run();
}


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

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

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

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

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

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

/// Stores elements in row-major order.
pub struct Matrix<T> {
  pub elements: Vec<T>,
  pub width: usize
}

impl<T> Matrix<T> {
  pub fn row_major_index(&self, idx: (usize, usize)) -> usize {
    let (x, y) = idx;
    y * self.width + x
  }

  pub fn get(&self, idx: (usize, usize)) -> Option<&T> {
    let index = self.row_major_index(idx);
    if index < self.elements.len() {
      Some(&self.elements[index])
    } else {
      None
    }
  }

  pub fn get_mut(&mut self, idx: (usize, usize)) -> Option<&mut T> {
    let index = self.row_major_index(idx);
    if index < self.elements.len() {
      Some(&mut self.elements[index])
    } else {
      None
    }
  }
}

impl<T> Matrix<T> where T: Default + Clone {
  pub fn new(width: usize, height: usize) -> Self {
    Matrix {
      elements: vec![T::default(); width * height],
      width: width
    }
  }
}

impl<T> Matrix<T> where T: Clone {
  pub fn with_default(width: usize, height: usize, default: T) -> Self {
    Matrix {
      elements: vec![default; width * height],
      width: width
    }
  }
}

const __IMPL_INDEX_FOR_MATRIX: () = {
  use std::ops::{Index, IndexMut};

  impl<T> Index<(usize, usize)> for Matrix<T> {
    type Output = T;
    fn index(&self, idx: (usize, usize)) -> &Self::Output {
      self.get(idx).unwrap()
    }
  }

  impl<T> IndexMut<(usize, usize)> for Matrix<T> {
    fn index_mut(&mut self, idx: (usize, usize)) -> &mut Self::Output {
      self.get_mut(idx).unwrap()
    }
  }
};

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

fn main() {
  let mut square = Matrix::new(4, 4);
  for j in 0..4 {
    scanln!(row: String);
    for (i, &b) in row.as_bytes().iter().enumerate() {
      square[(i, j)] = if b == b'#' { 1u64 } else { 0u64 };
    }
  }
  for i in 0..3 {
    for j in 0..3 {
      let sum = square[(i, j)] + square[(i+1, j)]
        + square[(i, j+1)] + square[(i+1, j+1)];
      match sum {
        0 | 1 | 3 | 4 => {
          println!("YES");
          return;
        },
        _ => ()
      }
    }
  }
  println!("NO");
}


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

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

    let a: Vec<_> = it.next().unwrap().chars().take(n).map(|c| {
        match c {
            '0' => false,
            '1' => true,
            _ => panic!(""),
        }
    }).collect();

    let ans = !(0..n).any(|i| {
        !a[i] &&
            (i == 0 || !a[i - 1]) &&
            (i == n - 1 || !a[i + 1])
    });

    let ans = ans &&
        (0..n - 1).all(|i| {
            !a[i] || !a[i + 1]
        });

    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


const INF: i64 = 1_000_000_000i64;

struct Graph {
    size: usize,
    edge: Vec<(usize, usize, i64, i64)>,
}

impl Graph {
    fn new(size: usize) -> Self {
        Graph {
            size: size,
            edge: vec![],
        }
    }
    fn add_edge(&mut self, src: usize, dst: usize, capa: i64, cost: i64) {
        assert!(src < self.size && dst < self.size && src != dst);
        self.edge.push((src, dst, capa, cost));
    }
    fn solve(&self, src: usize, dst: usize, flow: i64) -> Option<i64> {
        if src == dst {
            return Some(0);
        }
        let size = self.size;
        let edge = &self.edge;
        let mut deg = vec![0; size];
        for &(a, b, _, _) in edge.iter() {
            deg[a] += 1;
            deg[b] += 1;
        }
        let mut graph: Vec<_> = deg.into_iter().map(|d| Vec::with_capacity(d)).collect();
        for &(a, b, capa, cost) in edge.iter() {
            let x = graph[a].len();
            let y = graph[b].len();
            graph[a].push((b, capa, cost, y));
            graph[b].push((a, 0, -cost, x));
        }
        let mut ans = 0;
        let mut dp = Vec::with_capacity(size);
        let mut elem = Vec::with_capacity(size);
        let mut que = std::collections::VecDeque::new();
        for _ in 0..flow {
            dp.clear();
            dp.resize(size, (INF, src, 0));// コスト、親、親からの番号
            dp[src] = (0, src, 0);
            elem.clear();
            elem.resize(size, false);
            elem[src] = true;
            que.push_back(src);
            while let Some(v) = que.pop_front() {
                elem[v] = false;
                let (c, _, _) = dp[v];
                for (i, &(u, capa, cost, _)) in graph[v].iter().enumerate() {
                    if capa == 0 {
                        continue;
                    }
                    let c = c + cost;
                    if c < dp[u].0 {
                        dp[u] = (c, v, i);
                        if !elem[u] {
                            elem[u] = true;
                            que.push_back(u);
                        }
                    }
                }
            }
            if dp[dst].0 == INF {
                return None;
            }
            ans += dp[dst].0;
            let mut pos = dst;
            while pos != src {
                let (_, parent, k) = dp[pos];
                let inv = graph[parent][k].3;
                graph[parent][k].1 -= 1;
                graph[pos][inv].1 += 1;
                pos = parent;
            }
        }
        Some(ans)
    }
}

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

//

fn run() {
    input! {
        n: usize,
        m: usize,
        k: usize,
        c: i64,
        d: i64,
        a: [usize1; k],
        e: [(usize1, usize1); m],
    }
    let w = 101;
    let size = n * w + 2;
    let mut graph = Graph::new(size);
    let src = size - 1;
    let dst = src - 1;
    let pos = |a: usize, b: usize| -> usize {
        assert!(a < 101 && b < n);
        a * n + b
    };
    for a in a {
        graph.add_edge(src, pos(0, a), 1, 0);
    }
    for i in 0..w {
        graph.add_edge(pos(i, 0), dst, 50, c * i as i64);
    }
    for (a, b) in e {
        for i in 1..w {
            for j in 1..=n {
                let x = j as i64;
                graph.add_edge(pos(i - 1, a), pos(i, b), 1, d * (2 * x - 1));
                graph.add_edge(pos(i - 1, b), pos(i, a), 1, d * (2 * x - 1));
            }
        }
    }
    for i in 1..w {
        for j in 0..n {
            graph.add_edge(pos(i - 1, j), pos(i, j), 50, 0);
        }
    }
    let ans = graph.solve(src, dst, k as i64).unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


const INF: i64 = 1_000_000_000i64;

struct Graph {
    size: usize,
    edge: Vec<(usize, usize, i64, i64)>,
}

impl Graph {
    fn new(size: usize) -> Self {
        Graph {
            size: size,
            edge: vec![],
        }
    }
    fn add_edge(&mut self, src: usize, dst: usize, capa: i64, cost: i64) {
        assert!(src < self.size && dst < self.size && src != dst);
        self.edge.push((src, dst, capa, cost));
    }
    fn solve(&self, src: usize, dst: usize, flow: i64) -> Option<i64> {
        if src == dst {
            return Some(0);
        }
        let size = self.size;
        let edge = &self.edge;
        let mut deg = vec![0; size];
        for &(a, b, _, _) in edge.iter() {
            deg[a] += 1;
            deg[b] += 1;
        }
        let mut graph: Vec<_> = deg.into_iter().map(|d| Vec::with_capacity(d)).collect();
        for &(a, b, capa, cost) in edge.iter() {
            let x = graph[a].len();
            let y = graph[b].len();
            graph[a].push((b, capa, cost, y));
            graph[b].push((a, 0, -cost, x));
        }
        let mut ans = 0;
        let mut dp = Vec::with_capacity(size);
        let mut elem = Vec::with_capacity(size);
        let mut que = std::collections::VecDeque::new();
        for _ in 0..flow {
            dp.clear();
            dp.resize(size, (INF, src, 0));// コスト、親、親からの番号
            dp[src] = (0, src, 0);
            elem.clear();
            elem.resize(size, false);
            elem[src] = true;
            que.push_back(src);
            while let Some(v) = que.pop_front() {
                elem[v] = false;
                let (c, _, _) = dp[v];
                for (i, &(u, capa, cost, _)) in graph[v].iter().enumerate() {
                    if capa == 0 {
                        continue;
                    }
                    let c = c + cost;
                    if c < dp[u].0 {
                        dp[u] = (c, v, i);
                        if !elem[u] {
                            elem[u] = true;
                            que.push_back(u);
                        }
                    }
                }
            }
            if dp[dst].0 == INF {
                return None;
            }
            ans += dp[dst].0;
            let mut pos = dst;
            while pos != src {
                let (_, parent, k) = dp[pos];
                let inv = graph[parent][k].3;
                graph[parent][k].1 -= 1;
                graph[pos][inv].1 += 1;
                pos = parent;
            }
        }
        Some(ans)
    }
}

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

//

fn run() {
    input! {
        n: usize,
        m: usize,
        k: usize,
        c: i64,
        d: i64,
        a: [usize1; k],
        e: [(usize1, usize1); m],
    }
    let w = 101;
    let size = n * w + 2;
    let mut graph = Graph::new(size);
    let src = size - 1;
    let dst = src - 1;
    let pos = |a: usize, b: usize| -> usize {
        assert!(a < 101 && b < n);
        a * n + b
    };
    for a in a {
        graph.add_edge(src, pos(0, a), 1, 0);
    }
    for i in 0..w {
        graph.add_edge(pos(i, 0), dst, 50, c * i as i64);
    }
    for (a, b) in e {
        for i in 1..w {
            for j in 1..=k {
                let x = j as i64;
                graph.add_edge(pos(i - 1, a), pos(i, b), 1, d * (2 * x - 1));
                graph.add_edge(pos(i - 1, b), pos(i, a), 1, d * (2 * x - 1));
            }
        }
    }
    for i in 1..w {
        for j in 0..n {
            graph.add_edge(pos(i - 1, j), pos(i, j), 50, 0);
        }
    }
    let ans = graph.solve(src, dst, k as i64).unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


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

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

    let n = input.u();
    let a = input.vi(n);
    let mut sol = 0;
    for i in 1..n {
        m!(>, sol, a[i] - a[i-1]);
    }
    let mut res = 1000;
    for i in 1..=n-2 {
        m!(<, res, a[i+1] - a[i-1]);
    }
    println!("{}", sol.max(res));
}