In an examination, the average marks obtained by students who passed was \( x\% \), while the average of those who failed was \( y\% \). The average marks of all students taking the exam was \( z\% \). Find in terms of \( x, y, z \), the percentage of students taking the exam who failed.