The ratio of girls to boys in Mr. Smith's homeroom is 3:4. The ratio in Mr. Smith's homeroom to students in the whole 7th grade is 1:5. The ratio of students in 7th grade to students in the whole middle school is 2:7. If there are 12 girls in Mr. Smith's homeroom, how many students are in the whole middle school?