use std::cmp::min; //{{{ #[allow(unused_macros)] macro_rules! getl { ( $( $t:ty ),* ) => { { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let s = s.trim_end(); let mut ws = s.split_whitespace(); ($(ws.next().unwrap().parse::<$t>().unwrap()),*) } }; } #[allow(unused_macros)] macro_rules! getl_vec { ( $t:ty ) => { { let mut s = String::new(); std::io::stdin().read_line(&mut s).unwrap(); let s = s.trim_end(); s.split_whitespace().map(|x| x.parse().unwrap()).collect::>() } }; } //}}} fn main() { let (n, x, y, z) = getl!(usize, i64, i64, i64); let mut a = getl_vec!(i64); for i in 0..n { a[i] += 1; } let mut z = z; for i in 0..n { let q = min(a[i] / 10000, z); z -= q; a[i] -= 10000 * q; } a.sort(); a.reverse(); for i in 0..n { if a[i] == 0 { break; } if z > 0 { z -= 1; a[i] = 0; } } let mut y = y; for i in 0..n { let q = min(a[i] / 5000, y); y -= q; a[i] -= 5000 * q; } a.sort(); a.reverse(); for i in 0..n { if a[i] == 0 { break; } if y > 0 { y -= 1; a[i] = 0; } } let mut x = x; for i in 0..n { let q = (a[i] + 1000 - 1) / 1000; x -= q; } if x >= 0 { println!("Yes"); } else { println!("No"); } }