시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 158 58 47 35.878%

문제

30년동안 열심히 돈을 모은 상근이는 드디어 아파트 하나를 구매했다. 상근이는 친구들을 최대한 많이 초대해 집들이를 하려고 한다.

집들이를 하기 전에 모든 사람이 앉을 수 있는 직사각형 식탁을 하나 사려고 한다. 식탁에 앉을 수 있는 사람의 수는 식탁의 둘레 길이와 같다. (네 변의 길이의 합)

상근이는 되도록 큰 식탁을 구매해서 되도록 많은 사람들과 같이 저녁을 먹을 수 있게 하려고 한다. 식탁은 항상 아파트의 변에 평행하게 놓아야 한다.

아파트의 레이아웃이 주어졌을 때, 상근이가 초대할 수 있는 사람의 수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 아파트의 크기를 나타내는 R과 C가 주어진다. (1 ≤ R, C ≤ 400)

다음 R개 줄에는 C개의 문자가 주어지며, 빈 칸은 '.', 막힌 칸은 'X'로 주어진다.

상근이는 오직 빈 칸에만 식탁을 놓을 수 있다. 또, 사람의 크기는 매우 작다고 생각하면 된다.

출력

첫째 줄에 상근이가 초대할 수 있는 사람의 수를 출력한다.

예제 입력 1

4 4
X.XX
X..X
..X.
..XX

예제 출력 1

9
W3sicHJvYmxlbV9pZCI6IjMwNTAiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5ZDFcdWI0ZTRcdWM3NzQiLCJkZXNjcmlwdGlvbiI6IjxwPlxyXG5cdDMwXHViMTQ0XHViM2Q5XHVjNTQ4IFx1YzVmNFx1YzJlY1x1ZDc4OCBcdWIzYzhcdWM3NDQgXHViYWE4XHVjNzQwIFx1YzBjMVx1YWRmY1x1Yzc3NFx1YjI5NCBcdWI0ZGNcdWI1MTRcdWM1YjQgXHVjNTQ0XHVkMzBjXHVkMmI4IFx1ZDU1OFx1YjA5OFx1Yjk3YyBcdWFkNmNcdWI5ZTRcdWQ1ODhcdWIyZTQuIFx1YzBjMVx1YWRmY1x1Yzc3NFx1YjI5NCBcdWNlNW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