A cemetery has a form of rectangle. There are *N* rows of graves, *M* ones in each row. The cemetery is enclosed with a high fence.

Lara Croft has penetrated into the cemetery through the sap at the Northwestern corner. It takes one night for Lara to dig a subway under one of the graves. If there is an intact grave straight ahead then Lara will lengthen the passage during the next night and will ravage the grave. If there is a cemetery fence or a ravaged grave on the way, then Lara will turn 90 degrees clockwise and will continue with her questionable affairs.

Treasures are located in two graves only. And we exactly know in which ones. But Lara doesn't. Lara has bought a package of champagne today. It means, that today she has found one of those graves. We wonder how long will it take her to find the other one?

### Input

The first line contains integers *N* and *M* that are the sizes of the cemetery (2 ≤ *N*, *M* ≤ 100).
The North-Western grave has coordinates (1, 1) and the South-Eastern one — (*N*, *M*). Lara starts with the grave (1, 1) moving to the East, i.e. towards the grave (1, 2).

The second and the third lines contain integers (*r*_{1}, *c*_{1}) and (*r*_{2}, *c*_{2}) that are the treasure graves coordinates (1 ≤ *r*_{i} ≤ *N*; 1 ≤ *c*_{i} ≤ *M*). The order of graves is arbitrary, i.e. Lara may reach the first or the second grave earlier.

### Output

Output an amount of days that Lara will spend reaching for another grave with treasures.

### Sample

### Notes

In the example Lara will find the treasures on the 9'th and the 15'th days.

**Problem Author: **Stanislav Vasilyev

**Problem Source: **IX Urals Programming Contest. Yekaterinburg, April 19-24, 2005