Ravi bought x toys for 27$ and 3 mechanical pencils for x$.Given that the total cost of a toy and a mechanical pencil is 6$,write a quadratic equation in terms of x.