use std::{ convert::TryFrom, io::{stdin, BufRead}, iter::once, u64::MAX, }; use crate::cmpmore::CmpMore; fn main() { let stdin = stdin(); let mut stdin = stdin.lock().lines().map(Result::unwrap); let [n, p] = <[_; 2]>::try_from( stdin .next() .unwrap() .split_whitespace() .map(|x| x.parse::().unwrap()) .collect::>() .as_slice(), ) .unwrap(); let mut dp = vec![MAX; p + 1]; dp[0] = 0; for _ in 0..n { let a = <[_; 4]>::try_from( stdin .next() .unwrap() .split_whitespace() .map(|x| x.parse::().unwrap()) .chain(once(1)) .collect::>() .as_slice(), ) .unwrap(); let mut swp = vec![MAX; p + 1]; for i in (0..=p).rev() { for (w, &v) in a.iter().enumerate() { if i + w <= p { swp[i + w].change_min(dp[i].saturating_add(v)); } } } dp = swp; } let ans = dp[p] as f64 / n as f64; println!("{}", ans); } // lg {{{ #[allow(dead_code)] mod lg { #[macro_export] macro_rules! lg { (@contents $head:expr $(,)?) => { match $head { head => { eprintln!(" {} = {:?}", stringify!($head), &head); } } }; (@contents $head:expr $(,$tail:expr)+ $(,)?) => { match $head { head => { eprint!(" {} = {:?},", stringify!($head), &head); } } $crate::lg!(@contents $($tail),*); }; ($($expr:expr),* $(,)?) => { eprint!("[{}:{}]", file!(), line!()); $crate::lg!(@contents $($expr),*) }; } } // }}} // cmpmore {{{ #[allow(dead_code)] mod cmpmore { pub fn change_min(lhs: &mut T, rhs: T) { if *lhs > rhs { *lhs = rhs; } } pub fn change_max(lhs: &mut T, rhs: T) { if *lhs < rhs { *lhs = rhs; } } #[macro_export] macro_rules! change_min { ($lhs:expr, $rhs:expr) => { let rhs = $rhs; let lhs = $lhs; $crate::cmpmore::change_min(lhs, rhs); }; } #[macro_export] macro_rules! change_max { ($lhs:expr, $rhs:expr) => { let rhs = $rhs; let lhs = $lhs; $crate::cmpmore::change_max(lhs, rhs); }; } pub trait CmpMore: PartialOrd + Sized { fn change_min(&mut self, rhs: Self) { change_min(self, rhs) } fn change_max(&mut self, rhs: Self) { change_max(self, rhs) } } impl CmpMore for T {} } // }}}