John is trapped in a room with five indistinguishable doors. Behind two of the doors are paths to freedom; one path is two miles long, and the other path is five miles long. Behind three of the doors are paths that magically lead back to the room; one path is three miles long, another path is four miles long, and the final path is one mile long. If John returns to the room, the order of the doors are scrambled and the five doors are once again indistinguishable. How many miles will John travel before reaching freedom?