###### Description

You're moving your game character to pick an item in the following map:

The map is a combination of rectangles whose sides are parallel to the X-axis and Y-axis. The character will move along the boundary of this map (the lines in bold).

When these rectangles overlap, your character will move along the outermost boundary.

Two different rectangles don't share either X-coordinates or Y-coordinates.

For example, two different rectangles don't share either vertices or sides, as illustrated above.

The map will never be divided into two, as illustrated below:

No rectangle will be enveloped completely inside another rectangle, as illustrated below:

Suppose parameters `rectangle`

, `characterX`

, `characterY`

, `itemX`

, and `itemY`

are given, where `rectangle`

is a two-dimensional array representing the map, `characterX`

and `characterY`

the initial location of your character, and `itemX`

and `itemY`

the location of item. Please write a function `solution`

that returns the minimum distance that your character will travel to get the item.

##### Constraints

- The length of each column in
`rectangle`

is between 1 and 4. - Each element of
`rectangle`

is the coordinate information [bottom-left`x`

, bottom-left`y`

, top-right`x`

, top-right`y`

] of each rectangle.- The value of each coordinate is a natural number between 1 and 50.
- Two different rectangles don't share x-coordinates or y-coordinates.
- All given rectangles will meet the conditions described in the prompt above.

`characterX`

and`characterY`

are natural numbers between 1 and 50.- There will be a point on the outer boundary of the map.

`itemX`

and`itemY`

are natural numbers between 1 and 50.- There will be a point on the outer boundary of the map.

- The initial character location and the item location are never identical.

##### Example

rectangle | characterX | characterY | itemX | itemY | result |
---|---|---|---|---|---|

[[1,1,7,4],[3,2,5,5],[4,3,6,9],[2,6,8,8]] | 1 | 3 | 7 | 8 | 17 |

[[1,1,8,4],[2,2,4,9],[3,6,9,8],[6,3,7,7]] | 9 | 7 | 6 | 1 | 11 |

[[1,1,5,7]] | 1 | 1 | 4 | 7 | 9 |

[[2,1,7,5],[6,4,10,10]] | 3 | 1 | 7 | 10 | 15 |

[[2,2,5,5],[1,3,6,4],[3,1,4,6]] | 1 | 4 | 6 | 3 | 10 |

Example #1

The initial character location is (1, 3). The item location is (7, 8). The minimum distance travel is depicted above.

Example #2

The initial character location is (9, 7). The item location is (6, 1). The minimum distance travel is depicted above.

Example #3

The initial character location is (1, 1). The item location is (4, 7). The minimum distance travel is depicted above.

Example #4, #5

Omitted