use std::io::Read; fn main() { let mut all_data = String::new(); std::io::stdin().read_to_string(&mut all_data).ok(); let abcdefg: Vec = all_data.trim().split('\n').next().unwrap().split_whitespace() .map(|s| s.parse().unwrap()) .collect(); for a in 0..=abcdefg[0] { for b in 0..=abcdefg[1] { for c in 0..=abcdefg[2] { for d in 0..=abcdefg[3] { for e in 0..=abcdefg[4] { for f in 0..=abcdefg[5] { if 500*a + 100*b + 50*c + 10*d + 5*e + f == abcdefg[6] { println!("YES"); return; } } } } } } } println!("NO"); }