import sys
h, w = [int(x) for x in input().split()]
mat = [input() for _ in range(h)]
cnt = [[0] * w for _ in range(h)]
row_obs = [[-1] for _ in range(h)]
col_obs = [[-1] for _ in range(w)]

def main():
    for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
    for j in range(w):
        col_obs[j].append(h)

    for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

    for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
    print(ans)

if __name__ == '__main__':
    main() import sys sys 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 _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) input() input mat = [input() for _ in range(h)] mat [input() for _ in range(h)] [0] * w for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) [0] * w [0] 0 w cnt = [[0] * w for _ in range(h)] cnt [[0] * w for _ in range(h)] [-1] for _ in range(h) for _ in range(h) _ range(h) range h for _ in range(h) [-1] -1 row_obs = [[-1] for _ in range(h)] row_obs [[-1] for _ in range(h)] [-1] for _ in range(w) for _ in range(w) _ range(w) range w for _ in range(w) [-1] -1 col_obs = [[-1] for _ in range(w)] col_obs [[-1] for _ in range(w)] def main():
    for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
    for j in range(w):
        col_obs[j].append(h)

    for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

    for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
    print(ans) main for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
     i r enumerate(mat) enumerate mat for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
         j c enumerate(r) enumerate r if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
         c == '#' c '#' row_obs[i].append(j) [i].append [i] row_obs i append j col_obs[j].append(i) [j].append [j] col_obs j append i row_obs[i].append(w) [i].append [i] row_obs i append w for j in range(w):
        col_obs[j].append(h)

     j range(w) range w col_obs[j].append(h) [j].append [j] col_obs j append h for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

     i range(h) range h k = 0 k 0 while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

     True prev, nxt = (row_obs[i][k], row_obs[i][k+1]) prev (row_obs[i][k], row_obs[i][k+1]) row_obs[i][k] [i] row_obs i k row_obs[i][k+1] [i] row_obs i k+1 k 1 nxt for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
             j range(prev+1, nxt) range prev+1 prev 1 nxt cnt[i][j] += nxt - prev - 1 cnt[i][j] [i] cnt i j nxt - prev - 1 nxt - prev nxt prev 1 if nxt == w:
                break
             nxt == w nxt w break k += 1 k 1 for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

     j range(w) range w k = 0 k 0 while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

     True prev, nxt = (col_obs[j][k], col_obs[j][k+1]) prev (col_obs[j][k], col_obs[j][k+1]) col_obs[j][k] [j] col_obs j k col_obs[j][k+1] [j] col_obs j k+1 k 1 nxt for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
             i range(prev+1, nxt) range prev+1 prev 1 nxt cnt[i][j] += nxt - prev - 1 cnt[i][j] [i] cnt i j nxt - prev - 1 nxt - prev nxt prev 1 if nxt == h:
                break
             nxt == h nxt h break k += 1 k 1 ans = 0 ans 0 for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
     i range(h) range h for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
     j range(w) range w ans = max(ans, cnt[i][j] - 1) ans max(ans, cnt[i][j] - 1) max ans cnt[i][j] - 1 cnt[i][j] [i] cnt i j 1 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main h, w = [int(x) for x in input().split()] [int(x) for x in input().split()] h col_obs = [[-1] for _ in range(w)] [[-1] for _ in range(w)] col_obs w = [int(x) for x in input().split()] [int(x) for x in input().split()] w mat = [input() for _ in range(h)] [input() for _ in range(h)] mat cnt = [[0] * w for _ in range(h)] [[0] * w for _ in range(h)] cnt row_obs = [[-1] for _ in range(h)] [[-1] for _ in range(h)] row_obs def main():
    for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
    for j in range(w):
        col_obs[j].append(h)

    for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

    for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
    print(ans) def main():
    for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
    for j in range(w):
        col_obs[j].append(h)

    for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

    for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
    print(ans) main
import sys
h, w = [int(x) for x in input().split()]
mat = [input() for _ in range(h)]
cnt = [[0] * w for _ in range(h)]
row_obs = [[-1] for _ in range(h)]
col_obs = [[-1] for _ in range(w)]

def main():
    for i, r in enumerate(mat):
        for j, c in enumerate(r):
            if c == '#':
                row_obs[i].append(j)
                col_obs[j].append(i)
        row_obs[i].append(w)
    for j in range(w):
        col_obs[j].append(h)

    for i in range(h):
        k = 0
        while True:
            prev, nxt = (row_obs[i][k], row_obs[i][k+1])
            for j in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == w:
                break
            k += 1

    for j in range(w):
        k = 0
        while True:
            prev, nxt = (col_obs[j][k], col_obs[j][k+1])
            for i in range(prev+1, nxt):
                    cnt[i][j] += nxt - prev - 1
            if nxt == h:
                break
            k += 1

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, cnt[i][j] - 1)
    print(ans)

if __name__ == '__main__':
    main()