#![allow(unused_imports)]
#![allow(unused_macros)]
// use proconio::input;
use std::cmp::Ordering::*;
use std::collections::{BTreeMap, BTreeSet};
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};

// I have no idea what I'm doing

macro_rules! answer {
    ($out:ident, $ans:expr) => {
        writeln!($out, "{}", $ans)
    };
}

fn solve(mut a: Vec<i32>, i: usize) -> i32 {
    a.remove(i);
    a.windows(2).map(|v| v[1] - v[0]).max().unwrap()
}

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let n: usize = scan.token();
    let a: Vec<i32> = (0..n).map(|_| scan.token()).collect();

    let ans = (1..n-1).map(|i| solve(a.clone(), i)).min().unwrap();

    answer!(out, ans)
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

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

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

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}


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

fn get_num() -> usize {
    let mut input = String::new();

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

    usize::from_str(input.trim()).unwrap()
}

fn get_nums() -> Vec<usize> {
    let mut input = String::new();

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

    input
        .trim()
        .split_whitespace()
        .map(|s| usize::from_str(s).unwrap())
        .collect::<Vec<_>>()
}

fn main() {
    let n = get_num();
    let a = get_nums();

    let mut mn = std::usize::MAX;
    for i in 1..n - 1 {
        let mut mx = std::usize::MIN;
        let mut v = a.clone();
        v.remove(i);

        for j in 0..v.len() - 1 {
            mx = std::cmp::max(mx, v[j + 1] - v[j]);
        }

        mn = std::cmp::min(mn, mx);
    }

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


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

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

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

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

fn _main() {
    let mut scan = Scan::new();
    let mut nums: Vec<usize> = scan.next_n(3);
    nums[0] = nums[0].min(nums[1] - 1);
    nums[1] = nums[1].min(nums[2] - 1).min(nums[0] + 1);
    nums[2] = nums[2].min(nums[1] + 1);
    nums[0] = nums[0].min(nums[1] - 1);
    println!("{}", nums[0] + nums[1] + nums[2]);
}

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


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

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

    let a = input.i();
    let b = input.i();
    let c = input.i();
    println!("{}", 3 * b.min(a + 1).min(c - 1));
}


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


use std::io;

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

fn main() {
    let (y, b, r) = readln!(i32, i32, i32);

    let (y1, b1, r1) = (y, y + 1, y + 2);
    let (y2, b2, r2) = (b - 1, b, b + 1);
    let (y3, b3, r3) = (r - 2, r - 1, r);

    if y1 <= y && b1 <= b && r1 <= r {
        println!("{}", y1 + b1 + r1);
    } else if y2 <= y && b2 <= b && r2 <= r {
        println!("{}", y2 + b2 + r2);
    } else {
        println!("{}", y3 + b3 + r3);
    }
}


use std::char;
use std::fs::File;
use std::io::Read;

// fn pow_speedt_with_mod(mut p: i64, mut q: i64, m: i64) -> i64 {
//     p %= m;
//     let mut r = p;
//     let mut ret: i64 = 1;
//     while q > 0 {
//         ret *= if q % 2 == 1 {r} else {1};
//         r *= r;
//         r %= m;
//         q /= 2;
//         ret %= m;
//     }
//     return ret;
// }

fn main() {
    let inputstatus = 1;

    let mut buf = String::new();
    let filename = "inputrust.txt";

    if inputstatus == 0 {
        let mut f = File::open(filename).expect("file not found");
        f.read_to_string(&mut buf)
            .expect("something went wrong reading the file");
    } else {
        std::io::stdin().read_to_string(&mut buf).unwrap();
    }

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut p: usize = n;
    let mut q: usize = 0;
    let s: String = iter.next().unwrap().parse().unwrap();
    let mut v = vec![0; 26];
    let mut words = vec![];

    for c in s.chars() {
        if v[c as usize - 97] == 0 {
            v[c as usize - 97] = 1;
            if p > 0 {
                words.push(String::new());
                p -= 1;
                q += 1;
            }
        }
        words[q - 1].push(c);
    }
    if q == n {
        println!("YES");
        for w in &words {
            println!("{}", w);
        }
    } else {
        println!("NO");
    }

    // if p + 1 >= m

    // println!("{}", n);
    // println!("{}", k);
    // println!("{:?}", num);
    // println!("{:?}", cum_num);
}


#[allow(unused_imports)]
use std::io;
use std::mem::size_of_val;
use std::cmp::{max, min};
use std::rc::Rc;
use std::collections::btree_map::BTreeMap;
use std::io::{Write, BufRead, Read, BufReader};
use std::collections::{HashMap, VecDeque, BTreeSet};
use std::ptr::write_volatile;
use std::fs::File;

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

#[allow(dead_code)]
fn gets_from_file(f: &mut BufReader<File>) -> String {
    let mut contents = String::new();
    f.read_line(&mut contents).unwrap();
    contents.trim().to_string()
}

#[allow(unused)]
fn read_strings() -> 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
}

#[allow(unused)]
fn read_array_i32() -> Vec<i32> {
    let mut string: String = String::new();
    std::io::stdin().read_line(&mut string).unwrap();
    string.split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect()
}

#[allow(unused)]
fn read_array_usize() -> Vec<usize> {
    let mut string: String = String::new();
    std::io::stdin().read_line(&mut string).unwrap();
    string.split_whitespace().map(|x| x.parse::<usize>().unwrap()).collect()
}

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

// mod math;
// mod binary_search;
// mod graph;
// mod structure;
// mod fibonacci;
// mod string;
// mod permutations;
// mod patterns;

#[allow(dead_code)]
fn memory_properties<T>(value: &T)
    where
        T: std::fmt::Display + ?Sized,
{
    println!(
        "Variable address in memory = {:p}, Allocated bytes for type = {}",
        value,
        size_of_val(value)
    );
}

#[allow(unused_macros)]
macro_rules! sum {
    ($($x:expr), *) => {
        {
            let mut res = 0;
            $(res += $x;)*
            res
        }
    };
}

#[allow(unused)]
#[allow(non_upper_case_globals)]
static mut array: [[u8;51];51] = [[0u8; 51]; 51];
static ALPHABET: &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

fn main() {

    /*
    * Write/Read File
     */
    // let mut file = File::open("search.in").expect("file not found");
    // let mut input = BufReader::new(file);
    // file = File::create("search.out").expect("file not found");
    // let mut output = std::io::BufWriter::new(&mut file);

    use std::io::Write;
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());

    let mut seq: BTreeSet<u8> = BTreeSet::new();
    let mut n = gets().parse::<i32>().unwrap() - 1;
    let s = gets();
    let mut indexes = vec![0;1];
    seq.insert(s.as_bytes()[0]);
    let mut idx = 1;
    while n > 0 && idx < s.len(){
        if !seq.contains(&s.as_bytes()[idx]) {
            indexes.push(idx);
            seq.insert(s.as_bytes()[idx]);
            n -= 1;
        }
        idx += 1;
    }
    if n > 0 {
        writeln!(out, "NO");
    } else {
        indexes.push(s.len());
        writeln!(out, "YES");
        let idx = 0;
        for i in 1..indexes.len() {
            writeln!(out, "{}", &s[indexes[i - 1]..indexes[i]]);
        }
    }

    // writeln!(out, "{}", "Hello Rust").unwrap();
}


use std::io;

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

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

fn resolve(n: u32) -> String {
    let s = match n {
        0 => "zero",
        10 => "ten",
        1 => "one",
        11 => "eleven",
        2 => "two",
        12 => "twelve",
        20 => "twenty",
        3 => "three",
        13 => "thirteen",
        30 => "thirty",
        4 => "four",
        14 => "fourteen",
        40 => "forty",
        5 => "five",
        15 => "fifteen",
        50 => "fifty",
        6 => "six",
        16 => "sixteen",
        60 => "sixty",
        7 => "seven",
        17 => "seventeen",
        70 => "seventy",
        8 => "eight",
        18 => "eighteen",
        80 => "eighty",
        9 => "nine",
        19 => "nineteen",
        90 => "ninety",
        _ => panic!("WHAAAAT")
    };
    return String::from(s);
}

fn main() {
    let n: u32 = read_line().parse().unwrap();
    if n <= 20 {
        let s = resolve(n);
        println!("{}", s);
    } else {
        let s2 = resolve(n % 10);
        let s1 = resolve(10 * (n / 10));
        println!("{}-{}", s1, s2);
    }
}


use std::io;

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

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

fn resolve(n: u32) -> String {
    let s = match n {
        0 => "zero",
        10 => "ten",
        1 => "one",
        11 => "eleven",
        2 => "two",
        12 => "twelve",
        20 => "twenty",
        3 => "three",
        13 => "thirteen",
        30 => "thirty",
        4 => "four",
        14 => "fourteen",
        40 => "forty",
        5 => "five",
        15 => "fifteen",
        50 => "fifty",
        6 => "six",
        16 => "sixteen",
        60 => "sixty",
        7 => "seven",
        17 => "seventeen",
        70 => "seventy",
        8 => "eight",
        18 => "eighteen",
        80 => "eighty",
        9 => "nine",
        19 => "nineteen",
        90 => "ninety",
        _ => panic!("WHAAAAT")
    };
    return String::from(s);
}

fn main() {
    let n: u32 = read_line().parse().unwrap();
    if n <= 20 || n % 10 == 0 {
        let s = resolve(n);
        println!("{}", s);
    } else {
        let s2 = resolve(n % 10);

        let s1 = resolve(10 * (n / 10));
        println!("{}-{}", s1, s2);
    }
}


use std::collections::HashMap;
use std::io;
use std::str::FromStr;

fn get_num() -> usize {
    let mut input = String::new();

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

    usize::from_str(input.trim()).unwrap()
}

fn main() {
    let mut m = HashMap::new();

    m.insert(0, "zero");
    m.insert(1, "one");
    m.insert(2, "two");
    m.insert(3, "three");
    m.insert(4, "four");
    m.insert(5, "five");
    m.insert(6, "six");
    m.insert(7, "seven");
    m.insert(8, "eight");
    m.insert(9, "nine");
    m.insert(10, "ten");
    m.insert(11, "eleven");
    m.insert(12, "twelve");
    m.insert(13, "thirteen");
    m.insert(14, "fourteen");
    m.insert(15, "fifteen");
    m.insert(16, "sixteen");
    m.insert(17, "seventeen");
    m.insert(18, "eighteen");
    m.insert(19, "nineteen");
    m.insert(20, "twenty");
    m.insert(30, "thirty");
    m.insert(40, "forty");
    m.insert(50, "fifty");
    m.insert(60, "sixty");
    m.insert(70, "seventy");
    m.insert(80, "eighty");
    m.insert(90, "ninety");

    let n = get_num();

    if n < 20 || m.contains_key(&n) {
        println!("{}", m.get(&n).unwrap());
    } else {
        println!(
            "{}-{}",
            m.get(&(n / 10 * 10)).unwrap(),
            m.get(&(n % 10)).unwrap()
        );
    }
}


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

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

    let n = input.u();
    let a = input.i();
    let a = a - 1;
    let mut d = vec![Vec::new(); n];
    for (i,t) in input.ii(n).enumerate() {
        let i = i as i32;
        d[(i-a).abs() as usize].push(t);
    }
    let sol: i32 = d.into_iter().map(|a| {
        let l = a.len() as i32;
        let s = a.into_iter().sum();
        if s == l { s } else { 0 }
    }).sum();
    println!("{}", sol);
}


use std::io;
fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).unwrap();
    let n_a: Vec<usize> = buffer.split_whitespace().map(|x| x.parse::<usize>().unwrap()).collect();
    let (_, a) = (n_a[0], n_a[1] - 1);
    buffer.clear();
    io::stdin().read_line(&mut buffer).unwrap();
    let s: Vec<u32> = buffer.split_whitespace().map(|x| x.parse::<u32>().unwrap()).collect();
    let i: usize = a;
    let mut d: usize = 1;
    let mut ans: u32 = 0;
    if s[a] == 1 { ans += 1};
    loop {
        let left_idx = i.checked_sub(d);
        let right_idx = i + d;

        let left = match left_idx {
            Some(x) => Some(s[x]),
            None => None
        };

        let right = match right_idx {
            x if x < s.len() => Some(s[x]),
            _ => None
        };

        ans += match (left, right) {
            (Some(1), Some(1)) => 2,
            (None, Some(1)) => 1,
            (Some(1), None) => 1,
            _ => 0
        };

        if left.is_none() && right.is_none() {
            break;
        }

        d += 1
    }
    println!("{}", ans);
}


const N:usize = 505;

fn main() {

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

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

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

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

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

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

}


// ---------- begin next_permutation ----------
fn next_permutation<T: Ord>(a: &mut [T]) -> bool {
    a.windows(2).rposition(|a| a[0] < a[1]).map_or(false, |x| {
        let y = a.iter().rposition(|b| a[x] < *b).unwrap();
        a.swap(x, y);
        a[(x + 1)..].reverse();
        true
    })
}
// ---------- end next_permutation ----------
// ---------- begin ModInt ----------
mod modint {

    #[allow(dead_code)]
    pub struct Mod;
    impl ConstantModulo for Mod {
        const MOD: u32 = 1_000_000_007;
    }

    #[allow(dead_code)]
    pub struct StaticMod;
    static mut STATIC_MOD: u32 = 0;
    impl Modulo for StaticMod {
        fn modulo() -> u32 {
            unsafe { STATIC_MOD }
        }
    }

    #[allow(dead_code)]
    impl StaticMod {
        pub fn set_modulo(p: u32) {
            unsafe {
                STATIC_MOD = p;
            }
        }
    }

    use std::marker::*;
    use std::ops::*;

    pub trait Modulo {
        fn modulo() -> u32;
    }

    pub trait ConstantModulo {
        const MOD: u32;
    }

    impl<T> Modulo for T
    where
        T: ConstantModulo,
    {
        fn modulo() -> u32 {
            T::MOD
        }
    }

    pub struct ModInt<T>(pub u32, PhantomData<T>);

    impl<T> Clone for ModInt<T> {
        fn clone(&self) -> Self {
            ModInt::new_unchecked(self.0)
        }
    }

    impl<T> Copy for ModInt<T> {}

    impl<T: Modulo> Add for ModInt<T> {
        type Output = ModInt<T>;
        fn add(self, rhs: Self) -> Self::Output {
            let mut d = self.0 + rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            ModInt::new_unchecked(d)
        }
    }

    impl<T: Modulo> AddAssign for ModInt<T> {
        fn add_assign(&mut self, rhs: Self) {
            *self = *self + rhs;
        }
    }

    impl<T: Modulo> Sub for ModInt<T> {
        type Output = ModInt<T>;
        fn sub(self, rhs: Self) -> Self::Output {
            let mut d = T::modulo() + self.0 - rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            ModInt::new_unchecked(d)
        }
    }

    impl<T: Modulo> SubAssign for ModInt<T> {
        fn sub_assign(&mut self, rhs: Self) {
            *self = *self - rhs;
        }
    }

    impl<T: Modulo> Mul for ModInt<T> {
        type Output = ModInt<T>;
        fn mul(self, rhs: Self) -> Self::Output {
            let v = self.0 as u64 * rhs.0 as u64 % T::modulo() as u64;
            ModInt::new_unchecked(v as u32)
        }
    }

    impl<T: Modulo> MulAssign for ModInt<T> {
        fn mul_assign(&mut self, rhs: Self) {
            *self = *self * rhs;
        }
    }

    impl<T: Modulo> Neg for ModInt<T> {
        type Output = ModInt<T>;
        fn neg(self) -> Self::Output {
            if self.0 == 0 {
                Self::zero()
            } else {
                Self::new_unchecked(T::modulo() - self.0)
            }
        }
    }

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

    impl<T> std::fmt::Debug for ModInt<T> {
        fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
            write!(f, "{}", self.0)
        }
    }

    impl<T: Modulo> std::str::FromStr for ModInt<T> {
        type Err = std::num::ParseIntError;
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            let val = s.parse::<u32>()?;
            Ok(ModInt::new(val))
        }
    }

    impl<T: Modulo> From<usize> for ModInt<T> {
        fn from(val: usize) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as usize) as u32)
        }
    }

    impl<T: Modulo> From<u64> for ModInt<T> {
        fn from(val: u64) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as u64) as u32)
        }
    }

    impl<T: Modulo> From<i64> for ModInt<T> {
        fn from(val: i64) -> ModInt<T> {
            let m = T::modulo() as i64;
            ModInt::new((val % m + m) as u32)
        }
    }

    #[allow(dead_code)]
    impl<T> ModInt<T> {
        pub fn new_unchecked(d: u32) -> Self {
            ModInt(d, PhantomData)
        }
        pub fn zero() -> Self {
            ModInt::new_unchecked(0)
        }
        pub fn one() -> Self {
            ModInt::new_unchecked(1)
        }
        pub fn is_zero(&self) -> bool {
            self.0 == 0
        }
    }

    #[allow(dead_code)]
    impl<T: Modulo> ModInt<T> {
        pub fn new(d: u32) -> Self {
            ModInt::new_unchecked(d % T::modulo())
        }
        pub fn pow(&self, mut n: u64) -> Self {
            let mut t = Self::one();
            let mut s = *self;
            while n > 0 {
                if n & 1 == 1 {
                    t *= s;
                }
                s *= s;
                n >>= 1;
            }
            t
        }
    }
}
// ---------- end ModInt ----------

use modint::*;
type M = ModInt<StaticMod>;

// ---------- begin input macro ----------
// reference: 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")
    };
}
// ---------- end input macro ----------

use std::collections::*;
use std::io::Write;

type Map<K, V> = HashMap<K, V>;
type Set<T> = BTreeSet<T>;
type Deque<T> = VecDeque<T>;

fn run() {
    input!(n: usize, modulo: u32);
    StaticMod::set_modulo(modulo);
    /*
    for n in 1..=6 {
        let mut ans = 0;
        let mut a = (0..n).collect::<Vec<_>>();
        while {
            let mut b = a.clone();
            next_permutation(&mut b);
            while {
                let inv = |a: &[usize]| -> usize {
                    let mut cnt = 0;
                    for i in 0..a.len() {
                        for j in (i + 1)..a.len() {
                            if a[i] > a[j] {
                                cnt += 1;
                            }
                        }
                    }
                    cnt
                };
                if inv(&a) > inv(&b) {
                    ans += 1;
                }
                next_permutation(&mut b)
            }{}
            next_permutation(&mut a)
        }{}
        println!("{}: {}", n, ans);
    }
    */
    let mut binom  = vec![vec![M::zero(); n + 1]; n + 1];
    binom[0][0] = M::one();
    for i in 1..=n {
        binom[i][0] = M::one();
        for j in 1..=i {
            binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
        }
    }
    let mut fact = vec![M::one(); n + 1];
    for i in 1..=n {
        fact[i] = M::from(i) * fact[i - 1];;
    }
    let mut dp = Map::new();
    for rem in (1..=n).rev() {
        let mut next = Map::new();
        for i in 0..rem {
            for j in (i + 1)..rem {
                *next.entry(i as i32 - j as i32).or_insert(M::zero()) += fact[n - rem] * binom[n][rem];
            }
        }
        let mut trans = Map::new();
        for i in 0..rem {
            for j in 0..rem {
                *trans.entry(i as i32 - j as i32).or_insert(M::zero()) += M::one();
            }
        }
        for (diff, way) in dp {
            for (d, w) in trans.iter() {
                *next.entry(diff + *d).or_insert(M::zero()) += *w * way;
            }
        }
        dp = next;
    }
    let mut ans = M::zero();
    for (diff, way) in dp {
        if diff > 0 {
            ans += way;
        }
    }
    let ans = ans.0 % modulo;
    println!("{}", ans);
}

fn main() {
    run();
}


const N:usize = 505;

fn main() {

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

        let mut new_dp0 = temp_dp0;
        let mut new_dp1 = temp_dp1;
        for j in 0..(N*N){
            new_dp0[j]=0;
            new_dp1[j]=0;
        }
        let i = _i as usize;
        for _j in 0..(N*N-1){
            let j = _j as usize;
            if dp1[j]==0 &&  dp0[j]==0{
                continue;
            }
            new_dp1[j-i] = (new_dp1[j-i]+dp1[j])%modn;
            new_dp1[j+1] = (new_dp1[j+1]-2*dp1[j] + modn + modn)%modn;
            new_dp1[j+i+2]=(new_dp1[j+i+2]+dp1[j])%modn;

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

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

}


// ---------- begin ModInt ----------
mod modint {

    #[allow(dead_code)]
    pub struct Mod;
    impl ConstantModulo for Mod {
        const MOD: u32 = 1_000_000_007;
    }

    #[allow(dead_code)]
    pub struct StaticMod;
    static mut STATIC_MOD: u32 = 0;
    impl Modulo for StaticMod {
        fn modulo() -> u32 {
            unsafe { STATIC_MOD }
        }
    }

    #[allow(dead_code)]
    impl StaticMod {
        pub fn set_modulo(p: u32) {
            unsafe {
                STATIC_MOD = p;
            }
        }
    }

    use std::marker::*;
    use std::ops::*;

    pub trait Modulo {
        fn modulo() -> u32;
    }

    pub trait ConstantModulo {
        const MOD: u32;
    }

    impl<T> Modulo for T
    where
        T: ConstantModulo,
    {
        fn modulo() -> u32 {
            T::MOD
        }
    }

    pub struct ModInt<T>(pub u32, PhantomData<T>);

    impl<T> Clone for ModInt<T> {
        fn clone(&self) -> Self {
            ModInt::new_unchecked(self.0)
        }
    }

    impl<T> Copy for ModInt<T> {}

    impl<T: Modulo> Add for ModInt<T> {
        type Output = ModInt<T>;
        fn add(self, rhs: Self) -> Self::Output {
            let mut d = self.0 + rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            ModInt::new_unchecked(d)
        }
    }

    impl<T: Modulo> AddAssign for ModInt<T> {
        fn add_assign(&mut self, rhs: Self) {
            *self = *self + rhs;
        }
    }

    impl<T: Modulo> Sub for ModInt<T> {
        type Output = ModInt<T>;
        fn sub(self, rhs: Self) -> Self::Output {
            let mut d = T::modulo() + self.0 - rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            ModInt::new_unchecked(d)
        }
    }

    impl<T: Modulo> SubAssign for ModInt<T> {
        fn sub_assign(&mut self, rhs: Self) {
            *self = *self - rhs;
        }
    }

    impl<T: Modulo> Mul for ModInt<T> {
        type Output = ModInt<T>;
        fn mul(self, rhs: Self) -> Self::Output {
            let v = self.0 as u64 * rhs.0 as u64 % T::modulo() as u64;
            ModInt::new_unchecked(v as u32)
        }
    }

    impl<T: Modulo> MulAssign for ModInt<T> {
        fn mul_assign(&mut self, rhs: Self) {
            *self = *self * rhs;
        }
    }

    impl<T: Modulo> Neg for ModInt<T> {
        type Output = ModInt<T>;
        fn neg(self) -> Self::Output {
            if self.0 == 0 {
                Self::zero()
            } else {
                Self::new_unchecked(T::modulo() - self.0)
            }
        }
    }

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

    impl<T> std::fmt::Debug for ModInt<T> {
        fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
            write!(f, "{}", self.0)
        }
    }

    impl<T: Modulo> std::str::FromStr for ModInt<T> {
        type Err = std::num::ParseIntError;
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            let val = s.parse::<u32>()?;
            Ok(ModInt::new(val))
        }
    }

    impl<T: Modulo> From<usize> for ModInt<T> {
        fn from(val: usize) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as usize) as u32)
        }
    }

    impl<T: Modulo> From<u64> for ModInt<T> {
        fn from(val: u64) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as u64) as u32)
        }
    }

    impl<T: Modulo> From<i64> for ModInt<T> {
        fn from(val: i64) -> ModInt<T> {
            let m = T::modulo() as i64;
            ModInt::new((val % m + m) as u32)
        }
    }

    #[allow(dead_code)]
    impl<T> ModInt<T> {
        pub fn new_unchecked(d: u32) -> Self {
            ModInt(d, PhantomData)
        }
        pub fn zero() -> Self {
            ModInt::new_unchecked(0)
        }
        pub fn one() -> Self {
            ModInt::new_unchecked(1)
        }
        pub fn is_zero(&self) -> bool {
            self.0 == 0
        }
    }

    #[allow(dead_code)]
    impl<T: Modulo> ModInt<T> {
        pub fn new(d: u32) -> Self {
            ModInt::new_unchecked(d % T::modulo())
        }
        pub fn pow(&self, mut n: u64) -> Self {
            let mut t = Self::one();
            let mut s = *self;
            while n > 0 {
                if n & 1 == 1 {
                    t *= s;
                }
                s *= s;
                n >>= 1;
            }
            t
        }
    }
}
// ---------- end ModInt ----------

use modint::*;
type M = ModInt<StaticMod>;

// ---------- begin input macro ----------
// reference: 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")
    };
}
// ---------- end input macro ----------

use std::collections::*;
use std::io::Write;

type Map<K, V> = HashMap<K, V>;
type Set<T> = BTreeSet<T>;
type Deque<T> = VecDeque<T>;

// 一致してる間は転倒数一致、後ろの寄与も一致
// p_0 < q_0 の問題がn=2..50 で解ければいい
// 初項を決めたらあとは転倒数を保持するdpでいいんじゃ？
// N^5 になってるが
// いや7乗だこれ

fn run() {
    input!(n: usize, modulo: u32);
    StaticMod::set_modulo(modulo);
    let mut ans = M::zero();
    let mut binom = vec![vec![M::zero(); n + 1]; n + 1];
    binom[0][0] = M::one();
    for i in 1..=n {
        binom[i][0] = M::one();
        for j in 1..=i {
            binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
        }
    }
    let mut dp = Map::new();
    for rem in (1..=n).rev() {
        let mut next = Map::new();
        for i in 0..rem {
            for j in (i + 1)..rem {
                *next.entry(i as i32 - j as i32).or_insert(M::zero()) += binom[n][rem];
            }
        }
        let mut trans = Map::new();
        for i in 0..rem {
            for j in 0..rem {
                *trans.entry(i as i32 - j as i32).or_insert(M::zero()) += M::one();
            }
        }
        for (diff, way) in dp {
            for (d, w) in trans.iter() {
                *next.entry(diff + *d).or_insert(M::zero()) += *w * way;
            }
        }
        dp = next;
    }
    let mut ans = M::zero();
    for (diff, way) in dp {
        if diff > 0 {
            ans += way;
        }
    }
    let ans = ans.0 % modulo;
    println!("{}", ans);
}

fn main() {
    run();
}


// ---------- begin ModInt ----------
mod modint {

    #[allow(dead_code)]
    pub struct Mod;
    impl ConstantModulo for Mod {
        const MOD: u32 = 1_000_000_007;
    }

    #[allow(dead_code)]
    pub struct StaticMod;
    static mut STATIC_MOD: u32 = 0;
    impl Modulo for StaticMod {
        fn modulo() -> u32 {
            unsafe { STATIC_MOD }
        }
    }

    #[allow(dead_code)]
    impl StaticMod {
        pub fn set_modulo(p: u32) {
            unsafe {
                STATIC_MOD = p;
            }
        }
    }

    use std::marker::*;
    use std::ops::*;

    pub trait Modulo {
        fn modulo() -> u32;
    }

    pub trait ConstantModulo {
        const MOD: u32;
    }

    impl<T> Modulo for T
    where
        T: ConstantModulo,
    {
        fn modulo() -> u32 {
            T::MOD
        }
    }

    pub struct ModInt<T>(pub u32, PhantomData<T>);

    impl<T> Clone for ModInt<T> {
        fn clone(&self) -> Self {
            ModInt::new_unchecked(self.0)
        }
    }

    impl<T> Copy for ModInt<T> {}

    impl<T: Modulo> Add for ModInt<T> {
        type Output = ModInt<T>;
        fn add(self, rhs: Self) -> Self::Output {
            let mut d = self.0 + rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            ModInt::new_unchecked(d)
        }
    }

    impl<T: Modulo> AddAssign for ModInt<T> {
        fn add_assign(&mut self, rhs: Self) {
            *self = *self + rhs;
        }
    }

    impl<T: Modulo> Sub for ModInt<T> {
        type Output = ModInt<T>;
        fn sub(self, rhs: Self) -> Self::Output {
            let mut d = T::modulo() + self.0 - rhs.0;
            if d >= T::modulo() {
                d -= T::modulo();
            }
            ModInt::new_unchecked(d)
        }
    }

    impl<T: Modulo> SubAssign for ModInt<T> {
        fn sub_assign(&mut self, rhs: Self) {
            *self = *self - rhs;
        }
    }

    impl<T: Modulo> Mul for ModInt<T> {
        type Output = ModInt<T>;
        fn mul(self, rhs: Self) -> Self::Output {
            let v = self.0 as u64 * rhs.0 as u64 % T::modulo() as u64;
            ModInt::new_unchecked(v as u32)
        }
    }

    impl<T: Modulo> MulAssign for ModInt<T> {
        fn mul_assign(&mut self, rhs: Self) {
            *self = *self * rhs;
        }
    }

    impl<T: Modulo> Neg for ModInt<T> {
        type Output = ModInt<T>;
        fn neg(self) -> Self::Output {
            if self.0 == 0 {
                Self::zero()
            } else {
                Self::new_unchecked(T::modulo() - self.0)
            }
        }
    }

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

    impl<T> std::fmt::Debug for ModInt<T> {
        fn fmt<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
            write!(f, "{}", self.0)
        }
    }

    impl<T: Modulo> std::str::FromStr for ModInt<T> {
        type Err = std::num::ParseIntError;
        fn from_str(s: &str) -> Result<Self, Self::Err> {
            let val = s.parse::<u32>()?;
            Ok(ModInt::new(val))
        }
    }

    impl<T: Modulo> From<usize> for ModInt<T> {
        fn from(val: usize) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as usize) as u32)
        }
    }

    impl<T: Modulo> From<u64> for ModInt<T> {
        fn from(val: u64) -> ModInt<T> {
            ModInt::new_unchecked((val % T::modulo() as u64) as u32)
        }
    }

    impl<T: Modulo> From<i64> for ModInt<T> {
        fn from(val: i64) -> ModInt<T> {
            let m = T::modulo() as i64;
            ModInt::new((val % m + m) as u32)
        }
    }

    #[allow(dead_code)]
    impl<T> ModInt<T> {
        pub fn new_unchecked(d: u32) -> Self {
            ModInt(d, PhantomData)
        }
        pub fn zero() -> Self {
            ModInt::new_unchecked(0)
        }
        pub fn one() -> Self {
            ModInt::new_unchecked(1)
        }
        pub fn is_zero(&self) -> bool {
            self.0 == 0
        }
    }

    #[allow(dead_code)]
    impl<T: Modulo> ModInt<T> {
        pub fn new(d: u32) -> Self {
            ModInt::new_unchecked(d % T::modulo())
        }
        pub fn pow(&self, mut n: u64) -> Self {
            let mut t = Self::one();
            let mut s = *self;
            while n > 0 {
                if n & 1 == 1 {
                    t *= s;
                }
                s *= s;
                n >>= 1;
            }
            t
        }
    }
}
// ---------- end ModInt ----------

use modint::*;
type M = ModInt<StaticMod>;

// ---------- begin input macro ----------
// reference: 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")
    };
}
// ---------- end input macro ----------

use std::collections::*;
use std::io::Write;

type Map<K, V> = HashMap<K, V>;
type Set<T> = BTreeSet<T>;
type Deque<T> = VecDeque<T>;

// 一致してる間は転倒数一致、後ろの寄与も一致
// p_0 < q_0 の問題がn=2..50 で解ければいい
// 初項を決めたらあとは転倒数を保持するdpでいいんじゃ？
// N^5 になってるが
// いや7乗だこれ

fn run() {
    input!(n: usize, modulo: u32);
    StaticMod::set_modulo(modulo);
    let mut ans = M::zero();
    let mut binom = vec![vec![M::zero(); n + 1]; n + 1];
    binom[0][0] = M::one();
    for i in 1..=n {
        binom[i][0] = M::one();
        for j in 1..=i {
            binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
        }
    }
    let mut dp = Map::new();
    for rem in (1..=n).rev() {
        let mut next = Map::new();
        for i in 0..rem {
            for j in (i + 1)..rem {
                *next.entry(i as i32 - j as i32).or_insert(M::zero()) += binom[n][rem];
            }
        }
        let mut trans = Map::new();
        for i in 0..rem {
            for j in 0..rem {
                *trans.entry(i as i32 - j as i32).or_insert(M::zero()) += M::one();
            }
        }
        for (diff, way) in dp {
            for (d, w) in trans.iter() {
                *next.entry(diff + *d).or_insert(M::zero()) += *w * way;
            }
        }
        dp = next;
    }
    let mut ans = M::zero();
    for (diff, way) in dp {
        if diff > 0 {
            ans += way;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


fn is_sufficient(v: u64, n: u64, k: u64) -> bool {
    let summand_count = ((v as f64).log(k as f64).trunc() + 1_f64) as usize;
    // dbg!(summand_count);
    let sum: u64 = (0..summand_count).map(|x| v / k.checked_pow(x as u32).unwrap()).sum();
    // dbg!(sum);
    sum >= n
}

fn solve(n: u64, k: u64) -> u64 {
    let mut l: u64 = 1;
    let mut r: u64 = n + 1;
    while r - l > 2 {
        let m = l + (r - l) / 2;
        // dbg!(l, m, r);
        if is_sufficient(m, n, k) {
            // dbg!("YES");
            r = m + 1;
        } else {
            // dbg!("NO");
            l = m;
        }
    }
    // dbg!(is_sufficient(4, n, k));
    if is_sufficient(l, n, k) {l} else {l + 1}
}

fn main() {
    let (n, k) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut n_k = buf.trim().split_whitespace().map(|x| x.parse::<u64>().unwrap());
        let n = n_k.next().unwrap();
        let k = n_k.next().unwrap();
        (n, k)
    };

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


use std::io::stdin;

fn main() {
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    let mut input = input.split_whitespace().map(|k| k.parse::<u64>().unwrap());
    let m = input.next().unwrap();
    let b = input.next().unwrap();

    let ans = (0..(m * b + 1)).map(|x| {
        let y = b - (x + m - 1) / m;
        let tmp = (x + 1) * (y + 1) * (x + y) / 2 ;
        tmp
    }).max().unwrap();

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


#[allow(unused_imports)]
use std::cmp;
use std::fs::File;
use std::io::Read;

#[allow(dead_code)]
fn pow_speedy_with_mod(mut p: i64, mut q: i64, m: i64) -> i64 {
    p %= m;
    let mut r = p;
    let mut ret: i64 = 1;
    while q > 0 {
        ret *= if q % 2 == 1 { r } else { 1 };
        r *= r;
        r %= m;
        q /= 2;
        ret %= m;
    }
    return ret;
}

#[allow(dead_code)]
fn comb(n: usize, k: usize, m: i64, frac: &[i64], frac_inv: &[i64]) -> i64 {
    let mut ret = 1i64;
    if n < k {
        return 0;
    }
    ret *= frac[n] * frac_inv[n - k];
    ret %= m;
    ret *= frac_inv[k];
    ret %= m;
    ret
}

fn main() {
    let inputstatus = 1;

    let mut buf = String::new();
    let filename = "inputrust.txt";

    if inputstatus == 0 {
        let mut f = File::open(filename).expect("file not found");
        f.read_to_string(&mut buf)
            .expect("something went wrong reading the file");
    } else {
        std::io::stdin().read_to_string(&mut buf).unwrap();
    }

    let mut iter = buf.split_whitespace();

    let a: i64 = iter.next().unwrap().parse().unwrap();
    let mut b: i64 = iter.next().unwrap().parse().unwrap();
    let mut ans: i64 = 0;
    for i in 0..b + 1 {
        let x = a * i;
        ans = cmp::max(ans, (x + b) * (x + 1) * (b + 1) / 2);
        b -= 1;
    }
    println!("{}", ans);
    // let n = iter.next().unwrap().parse().unwrap();

    // println!("{}", n);
    // println!("{:?}", cum_num);
}


use std::io::stdin;

fn main() {
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    let mut input = input.split_whitespace().map(|k| k.parse::<u32>().unwrap());
    let m = input.next().unwrap();
    let b = input.next().unwrap();

    let ans = (0..(m * b + 1)).map(|x| {
        let y = b - (x + m - 1) / m;
        (x + 1) * (y + 1) / 2 * (x + y)
    }).max().unwrap();

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


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

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 mut n = parse_line!(u64);
    let mut result = 0;
    let mut add = 1;
    while n > 1 {
        result += n / 2 * add;
        add *= 2;
        n = (n + 1) / 2;
    }
    println!("{}", result);
}

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


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

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

    let bc = n.next_power_of_two().trailing_zeros();

    let mut cb = 1;
    let mut ans = 0;
    for _ in 0..bc {
        let t = cb * ((n - 1 + cb) / (cb << 1));
        ans += t;
        cb <<= 1;
    }

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


// ---------- 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<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl std::str::FromStr for ModInt {
    type Err = std::num::ParseIntError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let val = s.parse::<u32>()?;
        Ok(ModInt::new(val))
    }
}

impl From<usize> for ModInt {
    fn from(val: usize) -> ModInt {
        ModInt((val % MOD as usize) as u32)
    }
}

#[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 {
        assert!(self.0 > 0);
        self.pow(MOD - 2)
    }
}
// ---------- end ModInt ----------

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: u32 = it.next().unwrap().parse().unwrap();
    let k: usize = it.next().unwrap().parse().unwrap();
    let mut is_prime = vec![true; k + 1];
    for i in 2.. {
        if i * i > k {
            break;
        }
        if is_prime[i] {
            let mut j = i * i;
            while let Some(p) = is_prime.get_mut(j) {
                *p = false;
                j += i;
            }
        }
    }
    let mut mobius = vec![ModInt::one(); k + 1];
    for (i, p) in is_prime.into_iter().enumerate().skip(2) {
        if !p {
            continue;
        }
        let mut j = i;
        while let Some(x) = mobius.get_mut(j) {
            *x = -*x;
            j += i;
        }
        let k = i.saturating_mul(i);
        let mut j = k;
        while let Some(x) = mobius.get_mut(j) {
            *x = ModInt::zero();
            j += k;
        }
    }
    let pow: Vec<ModInt> = (0..=k).map(|k| ModInt::from(k).pow(n)).collect();
    let mut imos = vec![ModInt::zero(); 2 * k + 1];
    for (i, v) in mobius.into_iter().enumerate().skip(2) {
        if v.0 == 0 {
            continue;
        }
        for (x, &pow) in pow.iter().enumerate().skip(1) {
            if x * i > k {
                break;
            }
            let v = v * pow;
            let l = x * i;
            let r = (x + 1) * i;
            imos[l] += v;
            imos[r] -= v;
        }
    }
    let mut ans = ModInt::zero();
    for i in 1..=k {
        imos[i] = imos[i] + imos[i - 1];
        let way = ModInt::from(i).pow(n) + imos[i];
        ans += ModInt::new(way.0 ^ i as u32);
    }
    println!("{}", ans);
}

fn main() {
    run();
}


// ---------- 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<'a>(&self, f: &mut std::fmt::Formatter<'a>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}

impl std::str::FromStr for ModInt {
    type Err = std::num::ParseIntError;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let val = s.parse::<u32>()?;
        Ok(ModInt::new(val))
    }
}

impl From<usize> for ModInt {
    fn from(val: usize) -> ModInt {
        ModInt((val % MOD as usize) as u32)
    }
}

#[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 {
        assert!(self.0 > 0);
        self.pow(MOD - 2)
    }
}
// ---------- end ModInt ----------

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: u32 = it.next().unwrap().parse().unwrap();
    let k: usize = it.next().unwrap().parse().unwrap();
    let mut is_prime = vec![true; k + 1];
    for i in 2.. {
        if i * i > k {
            break;
        }
        if is_prime[i] {
            let mut j = i * i;
            while let Some(p) = is_prime.get_mut(j) {
                *p = false;
                j += i;
            }
        }
    }
    let mut mobius = vec![ModInt::one(); k + 1];
    for (i, p) in is_prime.into_iter().enumerate().skip(2) {
        if !p {
            continue;
        }
        let mut j = i;
        while let Some(x) = mobius.get_mut(j) {
            *x = -*x;
            j += i;
        }
        let k = i.saturating_mul(i);
        let mut j = k;
        while let Some(x) = mobius.get_mut(j) {
            *x = ModInt::zero();
            j += k;
        }
    }
    let mut imos = vec![ModInt::zero(); 2 * k + 1];
    for (i, v) in mobius.into_iter().enumerate().skip(2) {
        if v.0 == 0 {
            continue;
        }
        for x in 1.. {
            if x * i > k {
                break;
            }
            let v = v * ModInt::from(x).pow(n);
            let l = x * i;
            let r = (x + 1) * i;
            imos[l] += v;
            imos[r] -= v;
        }
    }
    let mut ans = ModInt::zero();
    for i in 1..=k {
        imos[i] = imos[i] + imos[i - 1];
        let way = ModInt::from(i).pow(n) + imos[i];
        ans += ModInt::new(way.0 ^ i as u32);
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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

use std::io::prelude::*;
use std::io::BufReader;
use std::cmp::{max, min};

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

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

fn extended_euclid(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (d0, x0, y0) = extended_euclid(b, a % b);
        (d0, y0, x0 - a / b * y0)
    }
}

fn main() {
    let a: Vec<u32> = get_vec();

    let sum: u32 = a.iter().cloned().sum();

    if sum % 2 != 0 {
        println!("NO");
        return;
    }

    for i in 0..6 {
        for j in i + 1..6 {
            for k in j + 1..6 {
                if a[i] + a[j] + a[k] == sum / 2 {
                    println!("YES");
                    return;
                }
            }
        }
    }

    println!("NO");
}


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

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

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

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

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

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

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

    for p in 0usize..1 << 6 {
        if p.count_ones() != 3 {
            continue;
        }

        let mut x = 0;
        let mut y = 0;

        for k in 0..6 {
            if (p >> k) & 1 == 1 {
                x += a[k];
            } else {
                y += a[k];
            }
        }
        if x == y {
            println!("YES");
            return;
        }
    }
    println!("NO");
}


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


//! http://codeforces.com/problemset/problem/808/C

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

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

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

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

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

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

fn main() {
  use std::io::{self, Write, BufWriter};
  let __stdout = io::stdout();
  let mut __out = BufWriter::with_capacity(4096, __stdout.lock());

  macro_rules! put {
    ($fmt:expr) => { write!(__out, $fmt).unwrap(); };
    ($fmt:expr, $($arg:expr),+) => { write!(__out, $fmt, $($arg),+).unwrap(); }
  }
  macro_rules! putln {
    () => { writeln!(__out, "").unwrap(); };
    ($fmt:expr) => { writeln!(__out, $fmt).unwrap(); };
    ($fmt:expr, $($arg:expr),+) => { writeln!(__out, $fmt, $($arg),+).unwrap(); }
  }
  macro_rules! fflush {
    () => { __out.flush().unwrap(); }
  }

  scanln!(n: u32, w: u32);
  scanln!(cups: Vec<u32>);

  let half: u32 = cups.iter()
    .map(|&cap| (cap + 1) / 2)
    .sum();

  if half > w {
    putln!("-1");
    return;
  }

  let mut rem = w - half;
  let mut cups: Vec<(usize, u32, u32)> = cups.into_iter()
    .enumerate()
    .map(|(i, max)| (i, max, (max + 1) / 2))
    .collect();
  cups.sort_by_key(|&(_, cap, _)| cap);
  for cup in cups.iter_mut().rev() {
    if rem == 0 { break; }
    let (_, ref mut max, ref mut amt) = *cup;
    let diff = std::cmp::min(*max - *amt, rem);
    rem -= diff;
    *amt += diff;
  }
  cups.sort_by_key(|&(i, _, _)| i);
  for &(i, _, amt) in cups.iter() {
    if i != 0 { put!(" "); }
    put!("{}", amt);
  }
  putln!();
}


fn main() {
    let (a, b) = {
        let res = getvec::<i32>();
        (res[0], res[1])
    };
    let sa = a - b;
    let flag = sa.abs() >= 2 || a + b == 0;
    let res = match flag {
        true => "NO",
        false => "YES",
    };
    println!("{}", res);
}

#[allow(dead_code)]
fn next_line() -> String {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input
}

#[allow(dead_code)]
fn getnum<T: std::str::FromStr>() -> T {
    let res = next_line();
    res.trim().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn getvec<T: std::str::FromStr>() -> Vec<T> {
    let res = next_line();
    res.split_whitespace().map(|x| x.parse::<T>().ok().unwrap()).collect()
}


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

#[allow(unused_macros)]
macro_rules! m {
    ($c:tt, $x:expr, $y:expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
#[allow(unused_macros)]
macro_rules! l {
    ($i:ident . $e:tt : $t:ty, $($a:ident),*) => {
        $( let $a: $t = $i.$e(); )*
    };
    ($i:ident . $e:tt, $($a:ident),*) => {
        $( let $a = $i.$e(); )*
    };
}

struct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).ok();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn f(&mut self) ->    f64 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn 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 std::iter::Iterator<Item=T> where T::Err: Debug {
        //(0..n).map(|_| self.p())
        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()
    }
}

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

    l!(input.i, a, b);
    if a + b > 0 && (a - b).abs() <= 1 {
        println!("YES");
    } else {
        println!("NO");
    }
}


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

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

fn main() {
    read_line!(even;i64, odd;i64);
    if odd == 0 && even == 0 {
        println!("NO"); // There must be one staircase
        return
    }
    if (odd - even).abs() <= 1 {
        // Valid count
        println!("YES")
    } else {
        println!("NO")
    }
}


#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

macro_rules! trace {
    ($var:expr) => ({
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    })
}
macro_rules! swap { ($a:expr, $b:expr) => ({ let t = $b; $b = $a; $a = t; }) }

fn main() {
    let mut sc = Scanner::new();
    let a: i32 = sc.cin();
    let b: i32 = sc.cin();

    let k = if a == b + 1 || a == b || a + 1 == b { "YES" } else { "NO" };
    println!("{}", k);

}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
    fn get_char(&mut self) -> char {
        self.reserve();
        let head = self.buffer[0].chars().nth(0).unwrap();
        let tail = String::from( &self.buffer[0][1..] );
        if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); }
        head
    }
}


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

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

fn main() {
    read_line!(even;u64, odd;u64);
    if odd == even || odd == even + 1 {
        println!("YES")
    } else {
        println!("NO")
    }
}


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

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

fn main() {
    read_line!(even;i64, odd;i64);
    if (odd - even).abs() <= 1 {
        println!("YES")
    } else {
        println!("NO")
    }
}


use std::{io,cmp};fn main(){let mut x=String::new();io::stdin().read_line(&mut x);let y:Vec<&str>=x.split_whitespace().collect();let a:i32=y[0].parse().unwrap();let b:i32=y[1].parse().unwrap();if a<1&&b>0{print!("Impossible");return}print!("{} {}",cmp::max(a,b),cmp::max(a+b-1,a+0))}


//1.25.0 | JDoodle.Com & 1.26 | CodeForces.Com
use std::{io,cmp};

fn main() {
    let mut input1 = String::new();
    io::stdin().read_line(&mut input1);
    let input2:Vec<&str> = input1.split_whitespace().collect();

    let grown_ups:i32 = input2[0].parse().unwrap();
    let children:i32 = input2[1].parse().unwrap();

    if grown_ups < 1 && children > 0 {
        print!("Impossible");
        return
    }

    print!("{} {}", cmp::max(grown_ups, children), cmp::max(grown_ups + children - 1, grown_ups + 0))
}


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

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

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

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

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

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

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

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

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

/// Verified by https://atcoder.jp/contests/arc093/submissions/3968098
mod mod_int {
    use std::ops::*;
    pub trait Mod: Copy { fn m() -> i64; }
    #[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)]
    pub struct ModInt<M> { pub x: i64, phantom: ::std::marker::PhantomData<M> }
    impl<M: Mod> ModInt<M> {
        // x >= 0
        pub fn new(x: i64) -> Self { ModInt::new_internal(x % M::m()) }
        fn new_internal(x: i64) -> Self {
            ModInt { x: x, phantom: ::std::marker::PhantomData }
        }
        pub fn pow(self, mut e: i64) -> Self {
            debug_assert!(e >= 0);
            let mut sum = ModInt::new_internal(1);
            let mut cur = self;
            while e > 0 {
                if e % 2 != 0 { sum *= cur; }
                cur *= cur;
                e /= 2;
            }
            sum
        }
        #[allow(dead_code)]
        pub fn inv(self) -> Self { self.pow(M::m() - 2) }
    }
    impl<M: Mod, T: Into<ModInt<M>>> Add<T> for ModInt<M> {
        type Output = Self;
        fn add(self, other: T) -> Self {
            let other = other.into();
            let mut sum = self.x + other.x;
            if sum >= M::m() { sum -= M::m(); }
            ModInt::new_internal(sum)
        }
    }
    impl<M: Mod, T: Into<ModInt<M>>> Sub<T> for ModInt<M> {
        type Output = Self;
        fn sub(self, other: T) -> Self {
            let other = other.into();
            let mut sum = self.x - other.x;
            if sum < 0 { sum += M::m(); }
            ModInt::new_internal(sum)
        }
    }
    impl<M: Mod, T: Into<ModInt<M>>> Mul<T> for ModInt<M> {
        type Output = Self;
        fn mul(self, other: T) -> Self { ModInt::new(self.x * other.into().x % M::m()) }
    }
    impl<M: Mod, T: Into<ModInt<M>>> AddAssign<T> for ModInt<M> {
        fn add_assign(&mut self, other: T) { *self = *self + other; }
    }
    impl<M: Mod, T: Into<ModInt<M>>> SubAssign<T> for ModInt<M> {
        fn sub_assign(&mut self, other: T) { *self = *self - other; }
    }
    impl<M: Mod, T: Into<ModInt<M>>> MulAssign<T> for ModInt<M> {
        fn mul_assign(&mut self, other: T) { *self = *self * other; }
    }
    impl<M: Mod> Neg for ModInt<M> {
        type Output = Self;
        fn neg(self) -> Self { ModInt::new(0) - self }
    }
    impl<M> ::std::fmt::Display for ModInt<M> {
        fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
            self.x.fmt(f)
        }
    }
    impl<M> ::std::fmt::Debug for ModInt<M> {
        fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
            self.x.fmt(f)
        }
    }
    impl<M: Mod> From<i64> for ModInt<M> {
        fn from(x: i64) -> Self { Self::new(x) }
    }
} // mod mod_int

macro_rules! define_mod {
    ($struct_name: ident, $modulo: expr) => {
        #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
        struct $struct_name {}
        impl mod_int::Mod for $struct_name { fn m() -> i64 { $modulo } }
    }
}
const MOD: i64 = 998244353;
define_mod!(P, MOD);
type ModInt = mod_int::ModInt<P>;

/// FFT (in-place, verified as NTT only)
/// R: Ring + Copy
/// Verified by: https://codeforces.com/contest/1096/submission/47672373
mod fft {
    use std::ops::*;
    /// n should be a power of 2. zeta is a primitive n-th root of unity.
    /// one is unity
    /// Note that the result should be multiplied by 1/sqrt(n).
    pub fn transform<R>(f: &mut [R], zeta: R, one: R)
        where R: Copy +
        Add<Output = R> +
        Sub<Output = R> +
        Mul<Output = R> {
        let n = f.len();
        assert!(n.is_power_of_two());
        {
            let mut i = 0;
            for j in 1 .. n - 1 {
                let mut k = n >> 1;
                loop {
                    i ^= k;
                    if k <= i { break; }
                    k >>= 1;
                }
                if j < i { f.swap(i, j); }
            }
        }
        let mut zetapow = Vec::new();
        {
            let mut m = 1;
            let mut cur = zeta;
            while m < n {
                zetapow.push(cur);
                cur = cur * cur;
                m *= 2;
            }
        }
        let mut m = 1;
        while m < n {
            let base = zetapow.pop().unwrap();
            let mut r = 0;
            while r < n {
                let mut w = one;
                for s in r .. r + m {
                    let u = f[s];
                    let d = f[s + m] * w;
                    f[s] = u + d;
                    f[s + m] = u - d;
                    w = w * base;
                }
                r += 2 * m;
            }
            m *= 2;
        }
    }
}

use fft::*;

// Depends on ModInt.rs
fn fact_init(w: usize) -> (Vec<ModInt>, Vec<ModInt>) {
    let mut fac = vec![ModInt::new(1); w];
    let mut invfac = vec![0.into(); w];
    for i in 1 .. w {
        fac[i] = fac[i - 1] * i as i64;
    }
    invfac[w - 1] = fac[w - 1].inv();
    for i in (0 .. w - 1).rev() {
        invfac[i] = invfac[i + 1] * (i as i64 + 1);
    }
    (fac, invfac)
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        k: usize,
        l: i64,
    }
    const N: usize = 4096;
    let (fac, invfac) = fact_init(N);

    let mut p = vec![ModInt::new(0); N];
    let mut q = vec![ModInt::new(0); N];
    p[1] = ModInt::new(2);
    p[2] = -ModInt::new(2);
    q[0] = ModInt::new(1);
    q[1] = -ModInt::new(2);
    q[2] = ModInt::new(2);

    let zeta = ModInt::new(3).pow((MOD - 1) / N as i64);
    transform(&mut p, zeta, ModInt::new(1));
    transform(&mut q, zeta, ModInt::new(1));

    let mut ans = vec![ModInt::new(0); N];
    let mut coef = vec![ModInt::new(0); N];
    for i in k..n + 1 {
        coef[i] = fac[n] * invfac[n - i] * invfac[i];
    }
    for j in 0..N {
        let mut pp = p[j].pow(k as i64);
        let mut qp = q[j].pow((n - k) as i64);
        let mut qinv = q[j].inv();
        for i in k..n + 1 {
            let coef = coef[i];
            ans[j] += pp * qp * coef;
            pp *= p[j];
            qp *= qinv;
        }
    }
    transform(&mut ans, zeta.inv(), ModInt::new(1));
    // eprintln!("ans = {:?}", &ans[0..10]);
    let mut tot = ModInt::new(0);
    for i in 0..2 * n + 1 {
        tot += ans[i] * ModInt::new((i + 1) as i64).inv();
    }
    tot *= ModInt::new(N as i64).inv();
    puts!("{}\n", tot * l);
}

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


// ---------- begin ModInt ----------
const MOD: u32 = 998_244_353;

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

fn run() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let k: usize = it.next().unwrap().parse().unwrap();
    let l: u32 = it.next().unwrap().parse().unwrap();
    let pc = Precalc::new(2 * n + 1);
    let mut dp = vec![ModInt::zero(); 2 * n + 1];
    dp[0] = ModInt::one();
    for i in 0..n {
        for j in (0..=(2 * i)).rev() {
            let p = dp[j];
            dp[j + 2] -= ModInt(2) * p;
            dp[j + 1] += ModInt(2) * p;
            dp[j] = ModInt(0);
        }
    }
    let mut ans = ModInt::zero();
    for i in (k..=n).rev() {
        let mut eval = ModInt::zero();
        for j in 0..=(2 * n) {
            eval += dp[j] * pc.inv(j + 1)
        }
        ans += pc.comb(n, i) * eval;
        let f = ModInt(2).inv();
        let mut next = vec![ModInt::zero(); 2 * n + 1];
        for j in (2..=(2 * n)).rev() {
            let v = dp[j];
            dp[j - 1] += v;
            next[j - 2] = -v * f;
        }
        dp = next;
        for j in (0..=(2 * (n - 1))).rev() {
            let v = dp[j];
            dp[j + 2] += ModInt(2) * v;
            dp[j + 1] -= ModInt(2) * v;
        }
    }
    ans *= ModInt(l);
    println!("{}", ans.0);
}

fn main() {
    run();
}


/*
 *
 * Author : fcbruce <fcbruce8964@gmail.com>
 *
 * Time : Sat 10 Feb 2018 19:40:59
 *
 */

fn check(x: i32, y: i32, z: i32) -> bool {
  return x < y && y < z && x + y > z;
}

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

  let n: i32 = buffer.trim().parse::<i32>().unwrap() + 1;

  let mut sum = 0;

  for x in 1..n {
    for y in 1..x {
      let z = x ^ y;
      if z < n &&  check(y, x, z) {
        sum += 1;
      }
    }
  }

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


// Try Codeforces
// author: Leonardone @ NEETSDKASU

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::<i64>().unwrap());
        ($t:ty) => (get().parse::<$t>().unwrap());
    }

    let n = get!();
    let mut ans = 0;
    for a in 1..n+1 {
        for b in a..n+1 {
            let c = a ^ b;
            if c >= b && c <= n && a + b > c {
                // println!("{} {} {}", a, b, c);
                ans += 1;
            }
        }
    }

    println!("{}", ans);

}


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

static M: i64 = 1000_000_007;

fn exponentiate( base: i64, mut exponent: i64 ) -> i64 {
    let mut ans = 1;
    let mut accum = base;
    while exponent != 0 {
        if exponent & 1 != 0 {
            ans = (ans * accum) % M;
        }
        accum = (accum * accum) % M;
        exponent = exponent >> 1;
    }
    ans
}

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 mut arr : Vec<_> = buffer.split_whitespace().map(|x| x.parse::<i64>().unwrap() ).collect();

    let n = arr[0];
    let m = arr[1];

    let ans = exponentiate((exponentiate(2,m)-1+M)%M,n);

    println!("{}",ans);

}

#[test]
fn test(){
    assert_eq!(27, exponentiate(3,3));
}


use std::io::BufRead;

const MOD: i64 = 1_000_000_007;

fn power(a: i64, p: i64) -> i64 {
    if p == 0 {
        return 1;
    }
    let mut res = power(a, p / 2);
    res = (res * res) % MOD;
    if p % 2 != 0 {
        res = (res * a) % MOD;
    }
    res
}

fn solve(n: i64, m: i64) -> i64 {
    power((power(2, m) + MOD - 1) % MOD, n)
}

fn main() {
    let stdin = std::io::stdin();
    let mut handle = stdin.lock();
    let mut buf = String::new();
    handle.read_line(&mut buf).unwrap();
    let mut it = buf.split_whitespace();
    let (n, m): (i64, i64) = (
        it.next().unwrap().parse().unwrap(),
        it.next().unwrap().parse().unwrap(),
    );
    println!("{}", solve(n, m));
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_power() {
        assert_eq!(power(0, 0), 1);
        assert_eq!(power(2, 1), 2);
        assert_eq!(power(2, 2), 4);
        assert_eq!(power(2, 3), 8);
    }

    #[test]
    fn test_solve() {
        assert_eq!(solve(1, 3), 7);
        assert_eq!(solve(2, 2), 9);
        assert_eq!(solve(1_000_000_000, 1_000_000_000), 751201557);
    }
}