Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

graphs

shortest paths

*1800

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. Labyrinth

time limit per test

2 secondsmemory limit per test

512 megabytesinput

standard inputoutput

standard outputYou are playing some computer game. One of its levels puts you in a maze consisting of *n* lines, each of which contains *m* cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row *r* and column *c*. 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 *x* times and move right no more than *y* 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 *n*, *m* (1 ≤ *n*, *m* ≤ 2000) — the number of rows and the number columns in the labyrinth respectively.

The second line contains two integers *r*, *c* (1 ≤ *r* ≤ *n*, 1 ≤ *c* ≤ *m*) — index of the row and index of the column that define the starting cell.

The third line contains two integers *x*, *y* (0 ≤ *x*, *y* ≤ 10^{9}) — 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 *j*-th character of the *i*-th line corresponds to the cell of labyrinth at row *i* and column *j*. 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

Input

4 5

3 2

1 2

.....

.***.

...**

*....

Output

10

Input

4 4

2 2

0 1

....

..*.

....

....

Output

7

Note

Cells, reachable in the corresponding example, are marked with '+'.

First example:

+++..

+***.

+++**

*+++.

Second example:

.++.

.+*.

.++.

.++.

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/31/2023 06:01:16 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|