A maze has been drawn on the graph paper. All walls are either horizontal or vertical.
Your task is simple: find the shortest route from the red dot to the green dot. You can only move horizontally or vertically.
NOTE: We assume that you can move very close to the walls (at distance 0).
The first line contains five numbers: . Here () is the number of lines in the maze, are the coordinates of the red dot, and are the coordinates of the green dot.
Each of the following lines describe one wall of the maze. A wall is described as four numbers , where either or .
All coordinates are in range .
Output the length of the shortest route between the two dots. You should output IMPOSSIBLE if there is no route.
You obtain a route of length 17 by moving very close to the endings of both inner walls.
Input
6 1 6 9 7 0 0 10 0 0 0 0 10 10 0 10 10 0 10 10 10 2 3 2 10 8 0 8 8
Output
17