A school was holding an event and tickets were sold to the teachers and pupils. Each teacher had to pay $20 each while each pupil had to pay $8 each. 1/4 of the tickets were bought by the teachers and the rest bought by the pupils. The total cost of tickets bought by the pupils was $416 more than the total cost of the tickets bought by the teachers. What was the total cost of all the tickets sold?