In an auditorium, 5/14 of the children were boys. 2/5 of the boys left and an additional 168 girls came into the auditorium. As a result, the number of boys to the number of girls became 1:5. How many boys were there at first?

total --- x

boys = 5/14 x
girls = 9/14 x

after exit: 2/5 of boys left, leaving 3/5 of boys
boys remaining = (3/5)(5x/14) = 3x/14
girls = 9x/14 + 168

3x/14 : (9x/14 + 168) = 1 : 5
9x/14 + 168 = 15x/14
168 = 6x/14
x = 392

so at first there were 5/14 of 392 boys or 140 boys