Tourist Routes
Travel company decided to develop trails in the mountainous region. All the routes out of the collection point and end point of travel departure. Help develop as much as possible routes of minimal length. The length of the route - the number of cells, through which it passes.
Given a map of the area - an array of M×N, in every cell which recorded a positive integer - height of the terrain. Tourists will be able to move from one square to another through a common side, if the height difference does not exceed 1.
Input
The first line contains 6 numbers M, N - size of the card, the coordinates of the point of collection A, B and the coordinates of left C, D (row number and column number). Further, written M rows by N of natural numbers - the altitude (the values do not exceed 100). M, N = 1..30.
Output
In a single line display one number - the number of routes of minimal length, or -1 if it is impossible to lay such a route.