just put 2 adjacent sides of the room, along which the fly will travel, flat together as a rectangle.
The diagonal of this rectangle then could be, depending on the position of the fly, sqrt[(3+4)^2 + 5^2] or sqrt[3^2 + (4+5)^2] or sqrt[4^2 + (3+5)^2]
These respectively are equal to sqrt(74), sqrt(90) and sqrt(80)
So the shortest is sqrt(74) m