Assumption first:
t0 -- minutes of queueing before opening of gates
X --- number of people coming per minute
Y --- passing rate of people per gate per minute
so,
40 minutes after opening of 3 gates -->
(40+t0)*X = 40*Y*3
25 minutes after opening of 4 gates -->
(25+t0)*X = 25*Y*4
Using the above 2 equations to derive the following -->
(10+t0)*X = 10*Y*8
which means that 10 minutes to clear all the people.
haha!