## 1368. 使网格图至少有一条有效路径的最小代价

Difficulty: 困难

• 1 ，下一步往右走，也就是你会从 grid[i][j] 走到 grid[i][j + 1]
• 2 ，下一步往左走，也就是你会从 grid[i][j] 走到 grid[i][j - 1]
• 3 ，下一步往下走，也就是你会从 grid[i][j] 走到 grid[i + 1][j]
• 4 ，下一步往上走，也就是你会从 grid[i][j] 走到 grid[i - 1][j]

## CF1063B. Labyrinth

You are playing some computer game. One of its levels puts you in a maze consisting of lines, each of which contains cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row and column . In one step you can move one square up, left, down or right, if the target cell is not occupied by an obstacle. You can’t move beyond the boundaries of the labyrinth.

Unfortunately, your keyboard is about to break, so you can move left no more than times and move right no more than times. There are no restrictions on the number of moves up and down since the keys used to move up and down are in perfect condition.

Now you would like to determine for each cell whether there exists a sequence of moves that will put you from the starting cell to this particular one. How many cells of the board have this property?

Input

The first line contains two integers — the number of rows and the number columns in the labyrinth respectively.

The second line contains two integers — index of the row and index of the column that define the starting cell.

The third line contains two integers — the maximum allowed number of movements to the left and to the right respectively.

The next n lines describe the labyrinth. Each of them has length of m and consists only of symbols . and *. The -th character of the -th line corresponds to the cell of labyrinth at row and column . Symbol . denotes the free cell, while symbol * denotes the cell with an obstacle.

It is guaranteed, that the starting cell contains no obstacles.

Output

Print exactly one integer — the number of cells in the labyrinth, which are reachable from starting cell, including the starting cell itself.

Examples

out

## CF173B. Chamber of Secrets

“The Chamber of Secrets has been opened again” — this news has spread all around Hogwarts and some of the students have been petrified due to seeing the basilisk. Dumbledore got fired and now Harry is trying to enter the Chamber of Secrets. These aren’t good news for Lord Voldemort. The problem is, he doesn’t want anybody to be able to enter the chamber. The Dark Lord is going to be busy sucking life out of Ginny.

The Chamber of Secrets is an rectangular grid in which some of the cells are columns. A light ray (and a basilisk’s gaze) passes through the columns without changing its direction. But with some spell we can make a column magic to reflect the light ray (or the gaze) in all four directions when it receives the ray. This is shown in the figure below.

The basilisk is located at the right side of the lower right cell of the grid and is looking to the left (in the direction of the lower left cell). According to the legend, anyone who meets a basilisk’s gaze directly dies immediately. But if someone meets a basilisk’s gaze through a column, this person will get petrified. We know that the door to the Chamber is located on the left side of the upper left corner of the grid and anyone who wants to enter will look in the direction of its movement (in the direction of the upper right cell) from that position.

Given the dimensions of the chamber and the location of regular columns, Lord Voldemort has asked you to find the minimum number of columns that we need to make magic so that anyone who wants to enter the chamber would be petrified or just declare that it’s impossible to secure the chamber.

Input

The first line of the input contains two integer numbers n and m . Each of the next lines contains characters. Each character is either “.” or “#” and represents one cell of the Chamber grid. It’s “.” if the corresponding cell is empty and “#” if it’s a regular column.

Output

Print the minimum number of columns to make magic or -1 if it’s impossible to do.

Examples

oUT

Note

The figure above shows the first sample test. In the first sample we should make both columns magic. The dragon figure represents the basilisk and the binoculars represent the person who will enter the Chamber of secrets. The black star shows the place where the person will be petrified. Yellow lines represent basilisk gaze moving through columns.