import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector as V

main :: IO ()
main = do
  [h, w] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    encode :: (Int, Int) -> Int
    encode (i, j) = i * w + j
    decode :: Int -> (Int, Int)
    decode ij = ij `divMod` w
  xs <- VU.fromList . map ('.' ==) . concat . lines <$> getContents :: IO (VU.Vector Bool)
  let
    ls = VU.constructN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | 0 < j            = VU.last v + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = l :: Int
            (_, j) = decode ij
    rs = VU.constructrN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | j < w - 1        = VU.head v + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = h * w - l - 1 :: Int
            (_, j) = decode ij
    us = VU.constructN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | w <= l           = v VU.! (l - w) + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = l :: Int
    ds = VU.constructrN (h * w) rec
      where
        rec :: VU.Vector Int -> Int
        rec v | not (xs VU.! ij) = 0
              | w <= l           = v VU.! (w - 1) + 1
              | otherwise        = 1
          where
            l = VU.length v :: Int
            ij = h * w - l - 1 :: Int
    ys = VU.zipWith4 op ls rs us ds :: VU.Vector Int
      where
        op :: Int -> Int -> Int -> Int -> Int
        op l r u d = max 0 $ l + r + u + d - 3
  print . VU.maximum $ ys

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
