iepuras

Bugs Bunny is hiding in an orchard on the side of the forest. The orchard contains m x n trees, lined up as a matrix with m rows and n columns, the distance (vertical or horizontal) between any two adjacent trees being 1. The rows are numbered from 1 to m, from North to South, and the columns are numbered from 1 to n, from West to East. As such, the location of a tree in the orchard can be identified via the number of the row and of the column on which it is located.
The forest begins from the East side of the orchard (after column n) and is so thick that all animals are safe there. The rabbit has its hole at the base of a tree.
Look, a hunter has come into the orchard. He's fixed his position by a tree and is trying to hunt the rabbit without changing his position.
Feeling threatened, the rabbit intends to get to the forest. To do this it can move in 4 directions (North, South, East, West), making jumps with a length of 1. After each jump, the rabbit stops for a few seconds, during which time it is vulnerable if the hunter sees it.
The hunter can only see the rabbit if there is no tree in the segment that unites the tree next to which the hunter is standing and the tree next to which the rabbit is standing.

Task

Being given the size of the orchard, the location of the hunter and the location of the rabbit hole, determine the minimum risk to which the rabbit is exposed in his path from the hole to the forest. The risk of a path is equal to the number of trees on the path where the rabbit is seen by the hunter. Seeing as there is more than one minimum risk path, we're also interested in the minimum length of such a path (expressed in number of jumps made by the rabbit to get to the forest).

Input Data

Input file iepuras.in contains on the first line the number of rows, m, and the number of columns, n, of the orchard. The second line contains the positive integers Lv and Cv, separated by a space, representing the row and column on which the hunter is on, and the third line contains two positive integers, Li and Ci, separated by a space, representing the row and column where the rabbit hole is located.

Output Data

Output file iepuras.out will contain two lines. The first line will contain a single positive integer, R - the minimum risk to which the rabbit is exposed on its path from the rabbit hole to the forest. The second line will contain the minimum number of jumps the rabbit has to do on a minimum risk path that leads to the forest.

Constraints

Examples

iepuras.in iepuras.out Explanation
5 4
3 2
3 1

3
6

3 - is the minimum risk of paths.
6 - is the minimum number of jumps on a minimum risk path.
There is more than one minimum risk 3 paths. The same minimum number of jumps, 6, corresponds to all.
3 3
2 1
3 1

2
3

2 - is the minimum risk of paths.
3 - is the minimum number of jumps on a minimum risk path.
There are two minimum risk 2 paths One has 3 jumps, the other 4 jumps.
4 4
1 3
1 1

3
6

3 - is the minimum risk of paths.
6 - is the minimum number of jumps on a minimum risk path.
There is more than one minimum risk 3 paths. Some of these correspond to the smallest number of jumps, 6.

Time limit: 0.1 seconds/test

prof. Constantin Galatan
C.N. "Liviu Rebreanu" Bistriţa
Contact: tucu_galatan@yahoo.com