Pep Room Cleaner

easy
Pep's ML Team Has Created a room cleaning robot.
You need to tell the number of ways in which robot can clean the room.

Room is a 2D Matrix with dimensions m*n.
1-> where the robot will start
2-> where the robot with stop
-1-> Hurdles i.e robot cannot move at hurdles
0-> Empty space (need to be cleaned)

Now You Have to tell the number of ways robot can start from start cell (with 1 value) and stops at end cell (with 2 value), without moving to hurdles( with value -1) and cover all empty space (with value 0).

Input Format

Integer m and n (Dimensions of matrix) Integer sr and sc (starting cell) Integer er and ec (Ending cell) Integer block (number of blocked cell) block consecutive lines with 2 Integer Each br and bc (blocked cell)

Output Format

Integer n

Constraints

m == grid.length
n == grid[i].length
1 <= m, n <= 20
1 <= m * n <= 20
-1 <= mat[i][j] <= 2
There is exactly one starting cell and one ending cell.

Notice

NA

Example

Input
3 4
0 0
2 2
1
2 3
Output
2
Previous
Odd Lover
Next
Manage Fight

Related Questions