In an examination, 30% and 35% students respectively failed in History and Geography while 27% students failed in both subjects. If the number of students passing the examination is 248, find the total number of students who appeared in the examination.