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 the students taking the exam was \(z\%\). Find, in terms of \(x\), \(y\) and \(z\), the percentage of students taking the exam who failed.