You need to check if ( p_1 w_1 + p_2 w_2 + p_3 w_3 + p_4 w_4 S ). If so, output "YES", otherwise output "NO".