mra
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

A farmer has a rectangular land of size m×n. There are swamps in the land where the fencing is not possible. You need to find the perimeter of the largest rectangular fence that can be built on this land.

Input format:

The first line contains m and n. The next m lines contain n characters each describing the state of the land. 'x' (ascii value: 120) if it is a swamp and '.' ( ascii value:46) otherwise.

Output Format:

Output contains a single integer - the largest perimeter. If the rectangular fence cannot be built, print "impossible" (without quotes).

Constraints:

2≤m,n≤1000

Sample input 1:

2 2

.x

x.

Sample output 1:

impossible

Sample Input 2:

2 5

. . . . .

xxxx.

Sample Output 2:

impossible

Register for Algorithms in IndiaHacks
SAMPLE INPUT
4 5
.....
.x.x.
.....
.....

SAMPLE OUTPUT
14

Explanation

The perimeter is 2∗(4−1)+2∗(5−1)=14.