urgent answer required

Roco is an island near Africa which is very prone to forest fire. Forest fire is such that it destroys the complete forest. Not a single tree is left.

This island has been cursed by God , and the curse is that whenever a tree catches fire, it passes the fire to all its adjacent tree in all 8 directions,North, South, East, West, North-East, North-West, South-East, and South-West.

And it is given that the fire is spreading every minute in the given manner, i.e every tree is passing fire to its adjacent tree.

Suppose that the forest layout is as follows where T denotes tree and W denotes water.

As you can see in the figure below, the tree at (3,3) will pass the fire to its adjacent 5 trees. Other 3 adjacent places have water and hence will not be impacted.

If suppose the tree that catches the fire is at (3,3) , then the fire from 3,3 will be passed on to (2,3),(3,4),(3,2), (4,2),(2,4) . Which will happen in 2nd minute.

Thus from the figure you can see in the 4th minute whole forest will be on fire.

Your task is that given the location of the first tree that catches fire, determine how long would it take for the entire forest to be on fire. You may assume that the lay out of the forest is such that the whole forest will catch fire for sure and that there will be at least one tree in the forest.
Input Format:

First line contains two integers, M, N, space separated, giving the size of the forest in terms of the number of rows and columns respectively

The next line contains two integers X,Y, space separated, giving the coordinates of the first tree that catches the fire

The next M lines, where ith line containing N characters each of which is either T or W, giving the position of the Tree and Water in the ith row of the forest.
Output Format:

Single integer indicating the number of minutes taken for the entire forest to catch fire

3 ≤ M ≤ 20
3 ≤ N ≤ 20

Example 1

3 3
1 3

Looks like a contest question to me. Could you please share the link of this problem? and why do you need so URGENT?