Problem:
Score : 400 points

Problem Statement

There is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.

Snuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.
The lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.
In each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.

Snuke wants to maximize the number of squares lighted by the lamp.

You are given H strings S_i (1 \leq i \leq H), each of length W. If the j-th character (1 \leq j \leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.

Find the maximum possible number of squares lighted by the lamp.

Constraints

1 \leq H \leq 2,000

1 \leq W \leq 2,000

S_i is a string of length W consisting of # and ..

. occurs at least once in one of the strings S_i (1 \leq i \leq H).

Input

Input is given from Standard Input in the following format:

H W
S_1
:
S_H

Output

Print the maximum possible number of squares lighted by the lamp.

Sample Input 1

4 6
#..#..
.....#
....#.
#.#...

Sample Output 1

8

If Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.

Sample Input 2

8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#

Sample Output 2

13

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h) cin >> s[i];

	// 累積和でいいじゃん
	vector<vector<int>> sumh(h + 1, vector<int>(w + 1, 0));
	vector<vector<int>> sumw(w + 1, vector<int>(h + 1, 0));

	rep(i, h) {
		Rep(j, 1, w + 1) {
			if (s[i][j-1] == '.') {
				sumh[i][j] = sumh[i][j - 1] + 1;
			}
			else {
				sumh[i][j] = 0;
			}
		}
	}

	rep(j, w) {
		Rep(i, 1, h + 1) {
			if (s[i-1][j] == '.') {
				sumw[j][i] = sumw[j][i - 1] + 1;
			}
			else {
				sumw[j][i] = 0;
			}
		}
	}
	//cout << "a" << endl;
	//戻してあげる
	rep(i, h) {
		for (int j = w; j > 0; j--) {
			if (sumh[i][j] == 0) continue;
			if (sumh[i][j - 1] == 0)continue;
			sumh[i][j - 1] = sumh[i][j];
		}
	}

	rep(j, w) {
		for (int i = h; i > 0; i--) {
			if (sumw[j][i] == 0) continue;
			if (sumw[j][i - 1] == 0)continue;
			sumw[j][i - 1] = sumw[j][i];
		}
	}

	int ans = 0;

	//全探索
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '#') continue;
			int tmp = 0;
			tmp = sumh[i][j + 1] + sumw[j][i + 1] - 1;
			ans = max(ans, tmp);
		}
	}

	cout << ans << endl;

	return 0;
}