#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
h, w = [int(x) for x in input().split()]
g = [input() for i in range(h)]
dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]
hit = [[[0 for j in range(w)] for i in range(h)] for dire in dirs]
for d, dire in enumerate(dirs):
    di, dj = dire
    for i in range(h) if di < 0 else reversed(range(h)):
        for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1
print(max(sum(hit[d][i][j] for d in range(len(dirs))) - 3 for i in range(h) for j in range(w) if g[i][j] != '#')) import sys sys input = lambda: sys.stdin.readline().strip() input lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x h, w = [int(x) for x in input().split()] h [int(x) for x in input().split()] w input() for i in range(h) for i in range(h) i range(h) range h for i in range(h) input() input g = [input() for i in range(h)] g [input() for i in range(h)] dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)] dirs [(-1, 0), (1, 0), (0, -1), (0, 1)] (-1, 0) -1 0 (1, 0) 1 0 (0, -1) 0 -1 (0, 1) 0 1 [[0 for j in range(w)] for i in range(h)] for dire in dirs for dire in dirs dire dirs for dire in dirs [[0 for j in range(w)] for i in range(h)] hit = [[[0 for j in range(w)] for i in range(h)] for dire in dirs] hit [[[0 for j in range(w)] for i in range(h)] for dire in dirs] for d, dire in enumerate(dirs):
    di, dj = dire
    for i in range(h) if di < 0 else reversed(range(h)):
        for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1 d dire enumerate(dirs) enumerate dirs di, dj = dire di dire dj for i in range(h) if di < 0 else reversed(range(h)):
        for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1 i range(h) if di < 0 else reversed(range(h)) di < 0 di 0 range(h) range h reversed(range(h)) reversed range(h) range h for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1 j range(w) if dj < 0 else reversed(range(w)) dj < 0 dj 0 range(w) range w reversed(range(w)) reversed range(w) range w if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1 g[i][j] != '#' g[i][j] [i] g i j '#' hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1 hit[d][i][j] [i] [d] hit d i j (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1 hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0 0 <= i + di < h and 0 <= j + dj < w 0 <= i + di < h 0 <= i + di 0 i + di i di h 0 <= j + dj < w 0 <= j + dj 0 j + dj j dj w hit[d][i + di][j + dj] [i + di] [d] hit d i + di i di j + dj j dj 0 1 print(max(sum(hit[d][i][j] for d in range(len(dirs))) - 3 for i in range(h) for j in range(w) if g[i][j] != '#')) print max(sum(hit[d][i][j] for d in range(len(dirs))) - 3 for i in range(h) for j in range(w) if g[i][j] != '#') max sum(hit[d][i][j] for d in range(len(dirs))) - 3 sum(hit[d][i][j] for d in range(len(dirs))) sum hit[d][i][j] [i] [d] hit d i j 3 dj = dire dire dj dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)] [(-1, 0), (1, 0), (0, -1), (0, 1)] dirs input = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() input h, w = [int(x) for x in input().split()] [int(x) for x in input().split()] h hit = [[[0 for j in range(w)] for i in range(h)] for dire in dirs] [[[0 for j in range(w)] for i in range(h)] for dire in dirs] hit di, dj = dire dire di g = [input() for i in range(h)] [input() for i in range(h)] g w = [int(x) for x in input().split()] [int(x) for x in input().split()] w
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
h, w = [int(x) for x in input().split()]
g = [input() for i in range(h)]
dirs = [(-1, 0), (1, 0), (0, -1), (0, 1)]
hit = [[[0 for j in range(w)] for i in range(h)] for dire in dirs]
for d, dire in enumerate(dirs):
    di, dj = dire
    for i in range(h) if di < 0 else reversed(range(h)):
        for j in range(w) if dj < 0 else reversed(range(w)):
            if g[i][j] != '#':
                hit[d][i][j] = (hit[d][i + di][j + dj] if 0 <= i + di < h and 0 <= j + dj < w else 0) + 1
print(max(sum(hit[d][i][j] for d in range(len(dirs))) - 3 for i in range(h) for j in range(w) if g[i][j] != '#'))