A school held an event and sold tickets to teachers and pupils. Teachers paid $20 per ticket and pupils paid $8 per ticket. 1/4 of the tickets were bought by teachers and the rest by pupils. The total cost of pupil tickets was $416 more than the cost of teacher tickets. The question is to calculate the total cost of all tickets sold.