program main
    integer H, W, i, j, path, N_black
    character, allocatable :: s(:,:)

    read(*,*) H, W
    allocate(s(H,W))
    do i = 1,W
        read(*,*) s(:,i)
    enddo

    N_black=0
    do i=1,H
        do j=1,W
            if(s(i,j)=='#') N_black=N_black+1
        enddo
    enddo
        
    write(*,*) H*W-(H+W-1)-N_black  
end program