has had enough. If he hears the Discord ping sound 1 more time, he WILL have a stroke. Day in and day out, the poor lad is constantly assaulted with an onslaught of cries for help from –it's gotten so bad that he has nightmares in which he helplessly drowns in an ocean filled with HELPs, @Sergeys, and <3_<3s. But no more, he says. knows that the only way to stop from pestering him is to banish him to the dark depths of #focus-mode. But to do this he requires the almighty Peen, a legendary artifact that appears only once a year, somewhere within the halls of TSS. has finally narrowed down the location of the Peen and sets out on a journey to obtain it. Pog! However, finds about his quest and places crates filled with cats and vegan treats at random spots throughout the school in hopes of distracting from reaching the Peen! Unpog! He hasn't got much time, so can you help find the shortest distance has to travel to reach the Peen while avoiding the beguiling boxes?
Input Specification
The first line of the input will contain 2 integers and , representing 's location.
The second line of the input will contain 2 integers and , representing the location of the Peen.
The third line will contain an integer denoting the number of boxes.
The next lines will contain integers denoting the , , (of the top-left corner), , and of each box.
Constraints
For all subtasks:
Output Specification
The shortest distance
has to travel, rounded to 2 decimal places. can travel along the edge of boxes, but cannot pass through them. This means that he can sneakily slip through 2 boxes that are perfectly adjacent to each other, as shown in Sample 1. There are also no boundaries, he can travel to negative coordinates if he needs to.Sample Input 1
100 0
100 100
2
0 40 100 20
100 50 20 20
Sample Output 1
100.00
Explanation
Sample Input 2
100 0
100 100
2
0 40 101 20
100 50 20 20
Sample Output 2
109.91
Explanation
The two boxes overlap, so Mr. Perogies cannot slip through and must go around.
Comments