Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went for class, and found out that some of the seats were occupied.

The classroom contains $n$ rows of seats and there are $m$ seats in each row. Then the classroom can be represented as an $n \times m$ matrix. The character '.' represents an empty seat, while '*' means that the seat is occupied. You need to find $k$ consecutive empty seats in the same row or column and arrange those seats for you and your friends. Your task is to find the number of ways to arrange the seats. Two ways are considered different if sets of places that students occupy differs.


-----Input-----

The first line contains three positive integers $n,m,k$ ($1 \leq n, m, k \leq 2\,000$), where $n,m$ represent the sizes of the classroom and $k$ is the number of consecutive seats you need to find.

Each of the next $n$ lines contains $m$ characters '.' or '*'. They form a matrix representing the classroom, '.' denotes an empty seat, and '*' denotes an occupied seat.


-----Output-----

A single number, denoting the number of ways to find $k$ empty seats in the same row or column.


-----Examples-----
Input
2 3 2
**.
...

Output
3

Input
1 2 2
..

Output
1

Input
3 3 4
.*.
*.*
.*.

Output
0



-----Note-----

In the first sample, there are three ways to arrange those seats. You can take the following seats for your arrangement.   $(1,3)$, $(2,3)$  $(2,2)$, $(2,3)$  $(2,1)$, $(2,2)$

Difficulty: EASY
Tags: Implementation

Complete search
Skill types: Complete search

Starter code:

Solutions:
def main():
	(n, m, k) = [int(x) for x in input().split()]
	size = 0
	h = [0] * m
	for i in range(n):
		M = input()
		length = 0
		for j in range(m):
			if M[j] == '.':
				length += 1
				h[j] += 1
				continue
			if length >= k:
				size += length - k + 1
			if h[j] >= k > 1:
				size += h[j] - k + 1
			length = 0
			h[j] = 0
		if length >= k:
			size += length - k + 1
	for i in range(m):
		if h[i] >= k > 1:
			size += h[i] - k + 1
	print(size)
main()


a = input().split()
(n, m, k) = (int(a[0]), int(a[1]), int(a[2]))
mat = []
for i in range(n):
	s = input()
	mat.append([])
	for j in range(m):
		if s[j] == '*':
			mat[i].append(0)
		else:
			mat[i].append(1)
ans = 0
for i in range(n):
	res = 0
	for j in range(m):
		if mat[i][j]:
			res += 1
			if res >= k:
				ans += 1
		else:
			res = 0
for i in range(m):
	res = 0
	for j in range(n):
		if mat[j][i]:
			res += 1
			if res >= k:
				ans += 1
		else:
			res = 0
if k == 1:
	ans /= 2
print(int(ans))


import sys

def count(class_map):
	result = 0
	for row in class_map:
		length = 0
		for seat in row:
			if seat == '.':
				length += 1
			else:
				if length >= k:
					result += length - k + 1
				length = 0
		if length >= k:
			result += length - k + 1
	return result
(n, m, k) = map(int, sys.stdin.readline().split())
class_map = [list(line.strip()) for line in sys.stdin]
result = 0
if k == 1:
	for row in class_map:
		for seat in row:
			if seat == '.':
				result += 1
	print(result)
	sys.exit(0)
print(count(class_map) + count(zip(*class_map)))


(m, n, k) = map(int, input().split())
Matrix = []
for i in range(m):
	s = input()
	Matrix.append([])
	for j in range(n):
		if s[j] == '*':
			Matrix[i].append(0)
		else:
			Matrix[i].append(1)
count = 0
for i in range(m):
	res = 0
	for j in range(n):
		if Matrix[i][j]:
			res += 1
			if res >= k:
				count += 1
		else:
			res = 0
for i in range(n):
	res = 0
	for j in range(m):
		if Matrix[j][i]:
			res += 1
			if res >= k:
				count += 1
		else:
			res = 0
if k == 1:
	count //= 2
print(count)


(n, m, k) = map(int, input().split())
a = []
ans = 0
for i in range(n):
	s = input()
	a.append(s)
	kk = 0
	for i in s:
		if i == '.':
			kk += 1
			if kk >= k:
				ans += 1
		else:
			kk = 0
for j in range(m):
	kk = 0
	for i in a:
		if i[j] == '.':
			kk += 1
			if kk >= k:
				ans += 1
		else:
			kk = 0
if k == 1:
	print(ans // 2)
else:
	print(ans)


import re
(n, m, k) = map(int, input().split())
s = [input() for _ in range(n)]
if n > 1 and k > 1:
	t = list(map(lambda x: ''.join(x), zip(*s)))
	s += t
ans = 0
p = re.compile('\\.{' + str(k) + ',}')
for i in s:
	ans += sum(map(lambda x: len(x) - k + 1, p.findall(i)))
print(ans)


(n, m, k) = [int(x) for x in input().split()]
LL = [''] * n
AllCount = 0
for i in range(n):
	LL[i] = input()
for i in range(n):
	length = 0
	for j in range(m):
		if LL[i][j] == '.':
			length += 1
		else:
			if length >= k:
				AllCount += length - k + 1
			length = 0
	if length >= k:
		AllCount += length - k + 1
for j in range(m):
	length = 0
	for i in range(n):
		if LL[i][j] == '.':
			length += 1
		else:
			if length >= k:
				AllCount += length - k + 1
			length = 0
	if length >= k:
		AllCount += length - k + 1
if k == 1:
	AllCount //= 2
print(AllCount)


from itertools import groupby
(n, m, k) = map(int, input().split())
seats = []
res = 0
for _ in range(n):
	seats.append(input())
	for (key, group) in groupby(seats[-1]):
		if key == '.':
			l = len(list(group))
			if l >= k:
				res += l - k + 1
for j in range(m):
	g = []
	for i in range(n):
		g.append(seats[i][j])
	for (key, group) in groupby(g):
		if key == '.':
			l = len(list(group))
			if l >= k:
				res += l - k + 1
if k == 1:
	res //= 2
print(res)


m = list(map(int, input().split()))[:3]
l = [0] * m[1]
c = 0
for i in range(m[0]):
	n = input()
	d = list(n)
	r = 0
	for j in range(m[1]):
		if d[j] == '.':
			if m[2] == 1:
				c = c + 1
				continue
			r = r + 1
			l[j] += 1
			if r == m[2]:
				c = c + 1
				r = r - 1
			if l[j] == m[2]:
				c = c + 1
				l[j] = l[j] - 1
		else:
			r = 0
			l[j] = 0
print(c)


(n, m, k) = map(int, input().split())
a = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
	s = input()
	for j in range(m):
		if s[j] == '.':
			a[i][j] = 1
		else:
			a[i][j] = 0
ans = 0
for i in range(n):
	res = 0
	for j in range(m):
		if a[i][j]:
			res += 1
			if res >= k:
				ans += 1
		else:
			res = 0
for i in range(m):
	res = 0
	for j in range(n):
		if a[j][i]:
			res += 1
			if res >= k:
				ans += 1
		else:
			res = 0
if not k - 1:
	ans //= 2
print(ans)


(n, m, k) = list(map(int, input().split()))
a = [[0] * m for x in range(n)]
s = []
count = 0
for i in range(n):
	s.append(input())
for i in range(n):
	y = 0
	for j in range(m):
		if s[i][j] == '.':
			if a[i][j] + 1 >= k and k > 1:
				count += 1
			y += 1
			if y >= k:
				count += 1
			if i + 1 < n:
				a[i + 1][j] = a[i][j] + 1
		else:
			y = 0
print(count)


(n, m, k) = list(map(int, input().split()))
d = [input() for _ in range(n)]
res = 0
for i in range(n):
	cs = 0
	for j in range(m):
		if d[i][j] == '.':
			cs += 1
		else:
			res += max(cs - k + 1, 0)
			cs = 0
	res += max(cs - k + 1, 0)
for j in range(m):
	cs = 0
	for i in range(n):
		if d[i][j] == '.':
			cs += 1
		else:
			res += max(cs - k + 1, 0)
			cs = 0
	res += max(cs - k + 1, 0)
if k == 1:
	print(res // 2)
else:
	print(res)


(n, m, k) = map(int, input().split())
a = []
ans = 0
for i in range(n):
	a.append(input())
if k == 1:
	for i in range(n):
		for j in range(m):
			if a[i][j] == '.':
				ans += 1
	print(ans)
	exit()
for i in range(n):
	l = 0
	for j in range(m):
		if a[i][j] == '.':
			l += 1
		else:
			ans += max(0, l - k + 1)
			l = 0
	ans += max(0, l - k + 1)
for i in range(m):
	l = 0
	for j in range(n):
		if a[j][i] == '.':
			l += 1
		else:
			ans += max(0, l - k + 1)
			l = 0
	ans += max(0, l - k + 1)
print(ans)


def method(matrix, k):
	if k == 1:
		res = sum((line.count('.') for line in matrix))
	else:
		res = 0
		for is_transpose in (False, True):
			if is_transpose or len(matrix[0]) >= k:
				for line in matrix:
					gen = iter(line)
					consecutive = 0
					for c in gen:
						if c == '.':
							consecutive += 1
						else:
							if consecutive >= k:
								res += consecutive - k + 1
							consecutive = 0
							try:
								while next(gen) == '*':
									pass
								consecutive = 1
							except StopIteration:
								pass
					if consecutive >= k:
						res += consecutive - k + 1
			if not is_transpose:
				if len(matrix) < k:
					break
				matrix = list(zip(*matrix))
	return res
(n, m, k) = list(map(int, input().split()))
matrix = []
for _ in range(n):
	matrix.append(input())
print(method(matrix, k))


(n, m, k) = [int(x) for x in input().split()]
lst = []
v = 0
for i in range(n):
	s = list(input())
	lst.append(s)
for i in range(n):
	z = 0
	for j in range(m):
		if lst[i][j] == '.':
			z += 1
		else:
			z = 0
		if z >= k:
			v += 1
for i in range(m):
	z = 0
	for j in range(n):
		if lst[j][i] == '.':
			z += 1
		else:
			z = 0
		if z >= k:
			v += 1
if k == 1:
	v = v / 2
print(int(v))


import sys, math, os.path
FILE_INPUT = 'c.in'
DEBUG = os.path.isfile(FILE_INPUT)
if DEBUG:
	sys.stdin = open(FILE_INPUT)

def ni():
	return list(map(int, input().split(' ')))

def nia():
	return list(map(int, input().split()))

def log(x):
	if DEBUG:
		print(x)
(n, m, k) = ni()
m1 = []
for _ in range(n):
	m1.append(list([x == '.' for x in input()]))
count = 0
if k == 1:
	count = 0
	print(sum((x.count(True) for x in m1)))
	return
for i in range(n):
	j = 0
	while j < m:
		cd = 0
		while j < m and (not m1[i][j]):
			j += 1
		while j < m and m1[i][j]:
			j += 1
			cd += 1
		if k <= cd:
			count += cd - k + 1
for j in range(m):
	i = 0
	while i < n:
		cd = 0
		while i < n and (not m1[i][j]):
			i += 1
		while i < n and m1[i][j]:
			i += 1
			cd += 1
		if k <= cd:
			count += cd - k + 1
print(count)


(n, m, k) = map(int, input().split())
result = 0
M1 = []
for _ in range(n):
	M1.append(list(map(lambda x: x == '*', input())))
M2 = [[M1[j][i] for j in range(n)] for i in range(m)]
for M in [M1, M2] if k > 1 else [M1]:
	for row in M:
		cnts = []
		sofar = 0
		for seat in row:
			if not seat:
				sofar += 1
			else:
				cnts.append(sofar)
				sofar = 0
		cnts.append(sofar)
		for cnt in cnts:
			result += max(0, cnt - k + 1)
print(result)


(n, m, k) = map(int, input().split())
arr = []
for i in range(n):
	s = str(input())
	arr.append(s)
ans = 0
for i in range(n):
	count = 0
	for j in range(m):
		if arr[i][j] == '*':
			if count >= k:
				ans += count - k + 1
			count = 0
		else:
			count += 1
	if count >= k:
		ans += count - k + 1
if k > 1:
	for i in range(m):
		count = 0
		for j in range(n):
			if arr[j][i] == '*':
				if count >= k:
					ans += count - k + 1
				count = 0
			else:
				count += 1
		if count >= k:
			ans += count - k + 1
print(ans)


import sys, math, bisect
from random import randint
inf = float('inf')
mod = 998244353

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors

def isPrime(n, k=5):
	if n < 2:
		return True
	for i in range(0, k):
		a = randint(1, n - 1)
		if pow(a, n - 1, n) != 1:
			return False
	return True
from collections import deque, defaultdict, Counter
import heapq, string
for _ in range(1):
	(row, col, k) = map(int, input().split())
	matt = []
	for _ in range(row):
		matt.append(list(input()))
	ans = 0
	for i in range(row):
		res = 0
		for j in range(col):
			if matt[i][j] == '.':
				res += 1
				if res >= k:
					ans += 1
			else:
				res = 0
	for i in range(col):
		res = 0
		for j in range(row):
			if matt[j][i] == '.':
				res += 1
				if res >= k:
					ans += 1
			else:
				res = 0
	if k == 1:
		print(ans // 2)
	else:
		print(ans)


import sys
input = sys.stdin.readline
(n, m, k) = map(int, input().rstrip().split())
M = [input() for _ in range(n)]
ans = 0
for row in M:
	run = 0
	for ch in row:
		if ch == '.':
			run += 1
		else:
			ans += max(0, run - k + 1)
			run = 0
	ans += max(0, run - k + 1)
if k != 1:
	for c in range(m):
		run = 0
		for r in range(n):
			if M[r][c] == '.':
				run += 1
			else:
				ans += max(0, run - k + 1)
				run = 0
		ans += max(0, run - k + 1)
print(ans)


(n, m, k) = map(int, input().split())
a = []
for _ in range(n):
	a.append(list(input()))
if k == 1:
	ans = 0
	for i in range(n):
		for j in range(m):
			if a[i][j] == '.':
				ans += 1
	print(ans)
else:
	ans = 0
	for i in range(n):
		end = -1
		for j in range(m - 1, -1, -1):
			if a[i][j] == '.':
				if end == -1:
					end = j
				elif end - j + 1 >= k:
					ans += 1
			else:
				end = -1
	for j in range(m):
		end = -1
		for i in range(n - 1, -1, -1):
			if a[i][j] == '.':
				if end == -1:
					end = i
				elif end - i + 1 >= k:
					ans += 1
			else:
				end = -1
	print(ans)


(n, m, k) = map(int, input().split())
arr = []
for _ in range(n):
	arr.append(input())
count = 0
for i in range(n):
	val = 0
	for j in range(m):
		if arr[i][j] == '.':
			val += 1
		else:
			val = 0
		if val == k:
			count += 1
			val -= 1
if k > 1:
	for j in range(m):
		val = 0
		for i in range(n):
			if arr[i][j] == '.':
				val += 1
			else:
				val = 0
			if val == k:
				count += 1
				val -= 1
print(count)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
(n, m, k) = inm()
ans = 0
col = [0] * (m + 1)
if k != 1:
	for _ in range(n + 1):
		s = ins() + '*' if _ != n else '*' * (m + 1)
		count = 0
		for i in range(m + 1):
			if s[i] == '.':
				count += 1
				col[i] += 1
			else:
				if count >= k:
					ans += count - k + 1
				count = 0
				if n == 1:
					continue
				if col[i] >= k:
					ans += col[i] - k + 1
				col[i] = 0
	print(ans)
else:
	for _ in range(n):
		s = ins()
		ans += s.count('.')
	print(ans)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
(row, col, limit) = RMI()
mats = [[0 if x == '*' else 1 for x in input()] for _ in range(row)]
ans = 0
for i in range(row):
	curr = 0
	for j in range(col):
		if mats[i][j]:
			curr += 1
			ans += curr >= limit
		else:
			curr = 0
for i in range(col):
	curr = 0
	for j in range(row):
		if mats[j][i]:
			curr += 1
			ans += curr >= limit
		else:
			curr = 0
if limit == 1:
	ans //= 2
print(ans)


for _ in range(1):
	(n, m, k) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(list(input()))
	ans = 0
	for i in range(n):
		j = 0
		c = 0
		while j < m:
			if l[i][j] == '.':
				c += 1
			else:
				if c >= k:
					ans += c - k + 1
				c = 0
			j += 1
		if c >= k:
			ans += c - k + 1
	for a in range(m):
		b = 0
		d = 0
		while b < n:
			if l[b][a] == '.':
				d += 1
			else:
				if d >= k:
					ans += d - k + 1
				d = 0
			b += 1
		if d >= k:
			ans += d - k + 1
	if k == 1:
		ans = ans // 2
	print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return input()

def iinp():
	return int(input())

def nninp():
	return map(int, input().split())

def llinp():
	return list(map(int, input().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
(n, m, k) = nninp()
mat = []
ans = 0
for i in range(n):
	a = stl(ssinp())
	mat.append(a)
if k == 1:
	for i in range(n):
		for j in range(m):
			if mat[i][j] == '.':
				ans += 1
	p(ans)
else:
	for i in range(n):
		tot = 0
		for j in range(m):
			if mat[i][j] == '.':
				tot += 1
			elif mat[i][j] == '*':
				if tot >= k:
					ans = ans + (tot - k + 1)
				tot = 0
		if tot >= k:
			ans = ans + (tot - k + 1)
			tot = 0
	for i in range(m):
		tot = 0
		for j in range(n):
			if mat[j][i] == '.':
				tot += 1
			elif mat[j][i] == '*':
				if tot >= k:
					ans = ans + (tot - k + 1)
				tot = 0
		if tot >= k:
			ans = ans + (tot - k + 1)
			tot = 0
	p(ans)


(n, m, k) = map(int, input().split())
s = []
up = [[0] * m] * n
left = [[0] * m] * n
ans = 0
for i in range(n):
	s.append(input())
	for j in range(m):
		if s[i][j] == '.':
			up[i][j] = (0 if i == 0 else up[i - 1][j]) + 1
			left[i][j] = (0 if j == 0 else left[i][j - 1]) + 1
		else:
			up[i][j] = 0
			left[i][j] = 0
		ans += up[i][j] >= k
		ans += left[i][j] >= k
if k == 1:
	ans //= 2
print(ans)


from collections import *
from math import *
(n, m, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(input())
ans = 0
if k == 1:
	for i in range(n):
		ans += a[i].count('.')
else:
	for i in range(n):
		ct = 0
		for j in range(m):
			if a[i][j] == '.':
				ct += 1
			if j - k >= 0:
				if a[i][j - k] == '.':
					ct -= 1
			if ct == k:
				ans += 1
	for i in range(m):
		ct = 0
		for j in range(n):
			if a[j][i] == '.':
				ct += 1
			if j - k >= 0:
				if a[j - k][i] == '.':
					ct -= 1
			if ct == k:
				ans += 1
print(ans)


(n, m, k) = [int(x) for x in input().split()]
ls = []
for i in range(n):
	bufls = []
	for j in input():
		if j == '.':
			bufls.append(True)
		else:
			bufls.append(False)
	ls.append(bufls)
freespase = 0
countls = []
for i in range(n):
	count = 0
	for j in range(m):
		if ls[i][j]:
			count += 1
		else:
			count = 0
		if count == k:
			freespase += 1
			count -= 1
if k > 1:
	for j in range(m):
		count = 0
		for i in range(n):
			if ls[i][j]:
				count += 1
			else:
				count = 0
			if count == k:
				freespase += 1
				count -= 1
print(freespase)


def main():
	(n, m, k) = map(int, input().split())
	g = []
	for i in range(n):
		g.append(input())
	ans = 0
	if k == 1:
		cnt = 0
		for i in range(n):
			for j in range(m):
				cnt += 1 if g[i][j] == '.' else 0
		print(cnt)
		return
	for i in range(n):
		cnt = 0
		for j in range(m):
			if g[i][j] == '.':
				cnt += 1
				if cnt >= k:
					ans += 1
			else:
				cnt = 0
	for j in range(m):
		cnt = 0
		for i in range(n):
			if g[i][j] == '.':
				cnt += 1
				if cnt >= k:
					ans += 1
			else:
				cnt = 0
	print(ans)

def __starting_point():
	main()
__starting_point()


(n, m, k) = list(map(int, input().split()))
f = [[x == '.' for x in input()] for _ in range(n)]
if k == 1:
	print(sum((sum(x) for x in f)))
	quit()
r = 0
for y in range(n):
	(b, e) = (0, 1)
	for x in range(m):
		if f[y][x]:
			e += 1
		else:
			r += max(0, e - b - k)
			(b, e) = (x, x + 1)
	r += max(0, e - b - k)
for x in range(m):
	(b, e) = (0, 1)
	for y in range(n):
		if f[y][x]:
			e += 1
		else:
			r += max(0, e - b - k)
			(b, e) = (x, x + 1)
	r += max(0, e - b - k)
print(r)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, m, k) = f()
l = []
for i in range(n):
	s = ls()
	l.append(s)
tc = 0
for i in range(n):
	c = 0
	for j in range(m):
		if l[i][j] == '.':
			c += 1
		else:
			if c >= k:
				tc += c - k + 1
			c = 0
	if c >= k:
		tc += c - k + 1
if k > 1:
	for i in range(m):
		c = 0
		for j in range(n):
			if l[j][i] == '.':
				c += 1
			else:
				if c >= k:
					tc += c - k + 1
				c = 0
		if c >= k:
			tc += c - k + 1
print(tc)


(row, col, req_seat) = map(int, input().split())
l = []
for _ in range(row):
	l.append([i for i in input()])
answer = 0
for i in range(row):
	count = 0
	for j in range(col):
		if l[i][j] == '.':
			count += 1
			if count >= req_seat:
				answer += 1
		else:
			count = 0
for i in range(col):
	count = 0
	for j in range(row):
		if l[j][i] == '.':
			count += 1
			if count >= req_seat:
				answer += 1
		else:
			count = 0
if req_seat == 1:
	answer //= 2
print(answer)


s = input()
s = s.strip().split(' ')
n = int(s[0])
m = int(s[1])
k = int(s[2])
mp = []
for i in range(n):
	string = input()
	temp = []
	for j in range(m):
		temp.append(string[j])
	mp.append(temp)
ans = 0
for i in range(n):
	begin = 0
	while begin < m:
		if mp[i][begin] == '.':
			temp = begin
			while mp[i][temp] == '.':
				temp += 1
				if temp == m:
					break
			length = temp - begin
			begin = temp
			ans += max(0, length - k + 1)
		begin += 1
for i in range(m):
	begin = 0
	while begin < n:
		if mp[begin][i] == '.':
			temp = begin
			while mp[temp][i] == '.':
				temp += 1
				if temp == n:
					break
			length = temp - begin
			begin = temp
			ans += max(0, length - k + 1)
		begin += 1
if k == 1:
	ans = 0
	for i in range(n):
		for j in range(m):
			if mp[i][j] == '.':
				ans += 1
print(ans)


from sys import stdin

def main():
	(k, r) = (int(input().split()[2]) - 1, 0)
	l = stdin.read().splitlines()
	if k:
		l += map(''.join, zip(*l))
		for s in l:
			for x in map(len, filter(None, s.split('*'))):
				if x > k:
					r += x - k
	else:
		r = sum((s.count('.') for s in l))
	print(r)
main()


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, m, k) = value()
a = []
tot = 0
ans = 0
for i in range(n):
	s = input()
	tot += s.count('.')
	a.append(s)
for i in range(n):
	j = 0
	while j < m:
		start = j
		j += 1
		while j < m and a[i][j] == a[i][j - 1] and (a[i][j] == '.'):
			j += 1
		ans += max(j - start - k + 1, 0)
for i in range(m):
	j = 0
	while j < n:
		start = j
		j += 1
		while j < n and a[j][i] == a[j - 1][i] and (a[j][i] == '.'):
			j += 1
		ans += max(j - start - k + 1, 0)
if k == 1:
	ans = tot
print(ans)


import sys
import math
import bisect

def solve(A, k):
	n = len(A)
	m = len(A[0])
	B = []
	for i in range(n):
		B.append([0] * m)
	C = []
	for i in range(n):
		C.append([0] * m)
	for i in range(n):
		for j in range(m):
			if i == 0:
				if A[i][j] == '.':
					B[i][j] = 1
			elif A[i][j] == '.':
				B[i][j] = 1 + B[i - 1][j]
	for i in range(n):
		for j in range(m):
			if j == 0:
				if A[i][j] == '.':
					C[i][j] = 1
			elif A[i][j] == '.':
				C[i][j] = 1 + C[i][j - 1]
	ans = 0
	for i in range(n):
		for j in range(m):
			if B[i][j] >= k:
				ans += 1
			if k > 1 and C[i][j] >= k:
				ans += 1
	return ans

def main():
	(n, m, k) = map(int, input().split())
	A = []
	for i in range(n):
		A.append(input())
	ans = solve(A, k)
	print(ans)
main()


from sys import stdin, stdout
import cProfile, math
from collections import Counter
printHeap = str()
test = False
memory_constrained = False

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def test_print(output):
	if test:
		stdout.write(str(output) + '\n')

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def sumDigits(n):
	sum = 0
	while n != 0:
		sum += n % 10
		n = n // 10
	return sum

def main():
	(n, m, k) = get_tuple()
	li = list()
	sts = 0
	for _ in range(n):
		a = list(stdin.readline().strip())
		c = 0
		for i in a:
			if i == '.':
				c += 1
			else:
				if c >= k:
					sts += c + 1 - k
				c = 0
		if c >= k:
			sts += c + 1 - k
		li.append(a)
	if k > 1:
		for m in range(m):
			c = 0
			for j in range(n):
				if li[j][m] == '.':
					c += 1
				else:
					if c >= k:
						sts += c + 1 - k
					c = 0
			if c >= k:
				sts += c + 1 - k
	print(sts)
cProfile.run('main()') if test else main()


(n, m, k) = (int(x) for x in input().split())
COLCON = [0 for _ in range(m)]
res = 0
for _ in range(n):
	con = 0
	for (i, c) in enumerate(input().strip()):
		if c == '*':
			con = 0
			COLCON[i] = 0
		else:
			con += 1
			if con >= k:
				res += 1
			COLCON[i] += 1
			if COLCON[i] >= k:
				res += 1
if k == 1:
	print(res // 2)
else:
	print(res)


(n, m, k) = map(int, input().split())
l = []
ans = 0
for i in range(n):
	l.append(input())
for i in range(n):
	j = 0
	obstical = -1
	while j < m:
		if l[i][j] == '*':
			ans += max(0, j - obstical - k)
			obstical = j
		j += 1
	ans += max(0, m - obstical - k)
for i in range(m):
	j = 0
	obstical = -1
	while j < n:
		if l[j][i] == '*':
			ans += max(0, j - obstical - k)
			obstical = j
		j += 1
	ans += max(0, n - obstical - k)
ans //= 2 if k == 1 else 1
print(ans)


from sys import stdin
(n, m, k) = [int(i) for i in input().split()]
s = stdin.read().splitlines()
result = 0
if k == 1:
	result = sum((elem.count('.') for elem in s))
	print(result)
	exit()
s += map(''.join, zip(*s))
for elem in s:
	for i in map(len, filter(None, elem.split('*'))):
		result += max(0, i - k + 1)
print(result)


import re
(n, m, k) = [int(x) for x in input().split()]
s = [input() for _ in range(n)]
print(sum([sum((len(x) - k + 1 for x in re.compile('\\.{' + str(k) + ',}').findall(i))) for i in (s + [''.join(x) for x in zip(*s)] if n > 1 and k > 1 else s)]))


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
(n, m, k) = list(map(int, input().split()))
grid = []
ans = 0
for _ in range(n):
	cons = 0
	grid.append(input().strip())
	for ch in grid[-1]:
		if ch == '.':
			cons += 1
		else:
			ans += max(0, cons - k + 1)
			cons = 0
	ans += max(0, cons - k + 1)
	cons = 0
for i in range(m):
	cons = 0
	for j in range(n):
		ch = grid[j][i]
		if ch == '.':
			cons += 1
		else:
			ans += max(0, cons - k + 1)
			cons = 0
	ans += max(0, cons - k + 1)
if k == 1:
	ans //= 2
print(ans)


(n, m, k) = [int(__) for __ in input().strip().split()]
arr = []
ans = 0
for _ in range(n):
	arr.append(list(input().strip()))
if k == 1:
	ans = 0
	for x in arr:
		ans += x.count('.')
	print(ans)
	exit(0)
if n == 1 and m == 1 and (k == 1):
	if arr[0][0] == '.':
		print(1)
	else:
		print(0)
else:
	for i in range(n):
		j = 0
		count = 0
		while j < m:
			if arr[i][j] == '.':
				count += 1
			else:
				if count >= k:
					ans += count - k + 1
				count = 0
			j += 1
		if count >= k:
			ans += count - k + 1
	for i in range(m):
		j = 0
		count = 0
		while j < n:
			if arr[j][i] == '.':
				count += 1
			else:
				if count >= k:
					ans += count - k + 1
				count = 0
			j += 1
		if count >= k:
			ans += count - k + 1
	print(ans)


(n, m, k) = map(int, input().split())

def count(M):
	nr = len(M)
	nc = len(M[0])
	res = 0
	for i in range(nr):
		j = 0
		while j < nc:
			while j < nc and M[i][j] == '*':
				j += 1
			j2 = j
			while j2 < nc and M[i][j2] == '.':
				j2 += 1
			res += max(0, j2 - j - k + 1)
			j = j2
	return res

def transpose(M):
	nr = len(M)
	nc = len(M[0])
	T = list()
	for j in range(nc):
		s = list()
		for i in range(nr):
			s.append(M[i][j])
		T.append(s)
	return T
M = list()
for i in range(n):
	M.append(input().strip())
res = count(M)
if k > 1:
	res += count(transpose(M))
print(res)


(n, m, k) = map(int, input().split())
a = []
r = [0] * n
c = [0] * m
for i in range(n):
	a.append(list(input()))
p = 0
for i in range(n):
	for j in range(m):
		if a[i][j] == '.':
			c[j] += 1
			r[i] += 1
		else:
			if c[j] >= k:
				p += c[j] - k + 1
			if r[i] >= k:
				p += r[i] - k + 1
			(c[j], r[i]) = (0, 0)
for i in range(n):
	if r[i] >= k:
		p += r[i] - k + 1
for j in range(m):
	if c[j] >= k:
		p += c[j] - k + 1
if k == 1:
	p //= 2
print(p)


(n, m, k) = map(int, input().split())
seats = [input() for i in range(n)]
r = 0
for i in range(n):
	j = 0
	while j < m:
		if seats[i][j] == '.':
			j0 = j
			j += 1
			while j < m and seats[i][j] == '.':
				j += 1
			r += max(j - j0 - k + 1, 0)
		j += 1
if k != 1:
	for j in range(m):
		i = 0
		while i < n:
			if seats[i][j] == '.':
				i0 = i
				i += 1
				while i < n and seats[i][j] == '.':
					i += 1
				r += max(i - i0 - k + 1, 0)
			i += 1
print(r)


sets = input().split()
total = 0
(n, m, k) = [int(tmp) for tmp in sets]
line_count = [0] * m
for i in range(n):
	row_data = input()
	row_count = 0
	for j in range(m):
		if row_data[j] == '.':
			if k == 1:
				total += 1
				continue
			row_count += 1
			line_count[j] += 1
			if row_count == k:
				total += 1
				row_count -= 1
			if line_count[j] == k:
				total += 1
				line_count[j] -= 1
		else:
			row_count = line_count[j] = 0
print(total)


(n, m, k) = map(int, input().split())
s = list()
sl = 0
if n == m and n == 1:
	zcw = input()
	if zcw[0] == '.' and k == 1:
		print(1)
	else:
		print(0)
else:
	for i in range(0, n):
		zcw = input()
		s.append(zcw)
		zc = 0
		for j in range(0, m):
			if zcw[j] == '.' and j < m - 1:
				zc += 1
			else:
				if j == m - 1 and zcw[j] == '.':
					zc += 1
				sl += max(0, zc - k + 1)
				zc = 0
	for j in range(0, m):
		if k == 1:
			break
		zc = 0
		for i in range(0, n):
			if s[i][j] == '.' and i < n - 1:
				zc += 1
			else:
				if i == n - 1 and s[i][j] == '.':
					zc += 1
				sl += max(0, zc - k + 1)
				zc = 0
	print(sl)


(nr, nc, k) = map(int, input().strip().split())
total = 0
cols = [0] * nc
for r in range(nr):
	row = input().strip()
	for (i, e) in enumerate(row):
		if e == '*':
			total += max(0, cols[i] - k + 1)
			cols[i] = 0
		else:
			cols[i] += 1
	total += sum((max(0, len(s) - k + 1) for s in row.split('*') if s))
total += sum((max(0, x - k + 1) for x in cols))
if k == 1:
	total //= 2
print(total)


(n, m, k) = [int(i) for i in input().split()]
grid = []
for i in range(n):
	grid.append(input())
streak = 0
ans = 0
for i in range(n):
	streak = 0
	for j in range(m):
		if grid[i][j] == '.':
			streak += 1
		if grid[i][j] == '*' or j == m - 1:
			if streak >= k:
				ans += streak - k + 1
			streak = 0
if k > 1:
	for i in range(m):
		streak = 0
		for j in range(n):
			if grid[j][i] == '.':
				streak += 1
			if grid[j][i] == '*' or j == n - 1:
				if streak >= k:
					ans += streak - k + 1
				streak = 0
print(ans)


(n, m, k) = map(int, input().split())
l = [[0] * m for i in range(n)]
for i in range(n):
	s = input()
	for j in range(m):
		if s[j] == '.':
			l[i][j] = 1
ans = 0
for i in range(n):
	c = 0
	for j in range(m):
		if l[i][j]:
			c += 1
			if c >= k:
				ans += 1
		else:
			c = 0
for j in range(m):
	c = 0
	for i in range(n):
		if l[i][j]:
			c += 1
			if c >= k:
				ans += 1
		else:
			c = 0
if k == 1:
	ans //= 2
print(ans)


(n, m, k) = map(int, input().split())
v = []
for i in range(n):
	aux = input()
	v.append(aux)
ans = 0
for i in range(n):
	cont = 0
	for j in range(m):
		if v[i][j] == '.':
			cont = cont + 1
		else:
			if cont >= k:
				ans = ans + (cont - k + 1)
			cont = 0
	if cont >= k:
		ans = ans + (cont - k + 1)
if k == 1:
	print(ans)
	exit(0)
for i in range(m):
	cont = 0
	for j in range(n):
		if v[j][i] == '.':
			cont = cont + 1
		else:
			if cont >= k:
				ans = ans + (cont - k + 1)
			cont = 0
	if cont >= k:
		ans = ans + (cont - k + 1)
print(ans)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = 1
for _ in range(testcases):
	(n, m, k) = vary(3)
	arr = []
	for i in range(n):
		arr.append([i for i in input()])
	rows = 0
	columns = 0
	i = 0
	while i < n:
		j = 0
		c = 0
		while j < m:
			if arr[i][j] == '.':
				c += 1
			else:
				rows += c - k + 1 if c >= k else 0
				c = 0
			j += 1
		rows += c - k + 1 if c >= k else 0
		i += 1
	i = 0
	while i < m:
		j = 0
		c = 0
		while j < n:
			if arr[j][i] == '.':
				c += 1
			else:
				columns += c - k + 1 if c >= k else 0
				c = 0
			j += 1
		columns += c - k + 1 if c >= k else 0
		i += 1
	if k == 1:
		print(rows)
	else:
		print(rows + columns)


import sys, os, io
from sys import stdin
from math import log, gcd, ceil
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
import math
alphabets = list('abcdefghijklmnopqrstuvwxyz')
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(int(i))
			n = n / i
	if n > 2:
		l.append(n)
	c = dict(Counter(l))
	return list(set(l))

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def sieveForSmallestPrimeFactor():
	MAXN = 100001
	spf = [0 for i in range(MAXN)]
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, math.ceil(math.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
	return spf

def getPrimeFactorizationLOGN(x):
	spf = sieveForSmallestPrimeFactor()
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def si():
	return input()

def divideCeil(n, x):
	if n % x == 0:
		return n // x
	return n // x + 1

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(n, m, k) = li()
	l = []
	for i in range(n):
		l.append(list(si()))
	if k == 1:
		ans = 0
		for i in l:
			ans += i.count('.')
		print(ans)
		return
	ans = 0
	for i in range(n):
		res = 0
		for j in range(0, m):
			if l[i][j] == '.':
				res += 1
			elif j > 0 and l[i][j] != l[i][j - 1] and (l[i][j] == '*'):
				ans += max(0, res - k + 1)
				res = 0
		if l[i][-1] == '.':
			ans += max(0, res - k + 1)
	for j in range(0, m):
		res = 0
		for i in range(n):
			if l[i][j] == '.':
				res += 1
			elif i > 0 and l[i - 1][j] != l[i][j] and (l[i][j] == '*'):
				ans += max(0, res - k + 1)
				res = 0
		if l[-1][j] == '.':
			ans += max(0, res - k + 1)
	print(ans)
t = 1
for _ in range(t):
	solve()


(n, m, k) = map(int, input().split())
ans = 0
c = [input() for i in range(n)]
if k == 1:
	for i in range(n):
		for j in range(m):
			if c[i][j] == '.':
				ans += 1
else:
	for i in range(n):
		e = 0
		for j in range(m):
			if c[i][j] == '.':
				e += 1
				if e >= k:
					ans += 1
			else:
				e = 0
	for i in range(m):
		e = 0
		for j in range(n):
			if c[j][i] == '.':
				e += 1
				if e >= k:
					ans += 1
			else:
				e = 0
print(ans)


import sys
input_str = sys.stdin.readlines()
(n, m, k) = (0, 0, 0)
DP = []
sol = 0
for (i, line) in enumerate(input_str):
	if n == 0:
		(n, m, k) = map(lambda x: int(x), line.split())
	else:
		DP.append([])
		for (j, char) in enumerate(line):
			if char == '.':
				(best_hor, best_ver) = (1, 1)
				if i > 1:
					best_ver = DP[i - 2][j][0] + 1
				if j > 0:
					best_hor = DP[i - 1][j - 1][1] + 1
				to_ad = (best_ver, best_hor)
				for res in to_ad:
					if res >= k:
						sol = sol + 1
				if k == 1:
					sol = sol - 1
				DP[i - 1].append(to_ad)
			else:
				DP[i - 1].append((0, 0))
print(sol)


(n, m, k) = map(int, input().split())
map = [list(input()) for i in range(n)]
rows = 0
for i in range(n):
	j = 0
	current = 0
	while j < m:
		if map[i][j] == '.':
			current += 1
		else:
			rows += max(0, current - k + 1)
			current = 0
		j += 1
	rows += max(0, current - k + 1)
cols = 0
for i in range(m):
	j = 0
	current = 0
	while j < n:
		if map[j][i] == '.':
			current += 1
		else:
			cols += max(0, current - k + 1)
			current = 0
		j += 1
	cols += max(0, current - k + 1)
print(cols + rows if k != 1 else rows)


(n, m, k) = list(map(int, input().strip().split()))
a = []
f = 0
for i in range(n):
	a.append(input())
	f = f + a[i].count('.')
if k == 1:
	print(f)
else:
	d = []
	for i in range(n):
		b = []
		c = 0
		for j in range(m):
			if a[i][j] == '.':
				c = c + 1
			else:
				b.append(c)
				c = 0
		b.append(c)
		d.append(b)
	e = []
	for i in range(m):
		b = []
		c = 0
		for j in range(n):
			if a[j][i] == '.':
				c = c + 1
			else:
				b.append(c)
				c = 0
		b.append(c)
		e.append(b)
	f = 0
	for i in range(len(d)):
		for j in range(len(d[i])):
			if d[i][j] >= k:
				f = f + (d[i][j] - k + 1)
	for i in range(len(e)):
		for j in range(len(e[i])):
			if e[i][j] >= k:
				f = f + (e[i][j] - k + 1)
	print(f)


(n, m, k) = map(int, input().split())
seats = [[0 for i in range(m)] for j in range(n)]
for i in range(n):
	s = input()
	for j in range(len(s)):
		if s[j] == '*':
			seats[i][j] = 1
		else:
			seats[i][j] = 0
combi = 0
if m >= k:
	for i in range(n):
		s = sum(seats[i][:k])
		if s == 0:
			combi += 1
		for j in range(1, m - k + 1):
			if seats[i][j - 1] == 1:
				s -= 1
			if seats[i][k - 1 + j] == 1:
				s += 1
			if s == 0:
				combi += 1
if n >= k:
	for i in range(m):
		s = 0
		for x in range(k):
			s += seats[x][i]
		if s == 0:
			combi += 1
		for j in range(1, n - k + 1):
			if seats[j - 1][i] == 1:
				s -= 1
			if seats[k - 1 + j][i] == 1:
				s += 1
			if s == 0:
				combi += 1
if k == 1:
	print(combi // 2)
else:
	print(combi)


(n, m, k) = map(int, input().split())
s = [input() for _ in range(n)]
if k > 1:
	s += [''.join(t) for t in zip(*s)]
summ = 0
for i in range(len(s)):
	summ += sum([len(t) - k + 1 for t in s[i].split('*') if len(t) >= k])
print(summ)


def readInt():
	return int(input())

def readInts():
	return [int(i) for i in input().split()]
(n, m, k) = readInts()
field = [input() for _ in range(n)]
empty = '.'
res = 0
for row in field:
	len = 0
	for cell in row:
		if empty == cell:
			len += 1
		else:
			len = 0
		if len >= k:
			res += 1
if k > 1:
	for c in range(m):
		len = 0
		for r in range(n):
			cell = field[r][c]
			if empty == cell:
				len += 1
			else:
				len = 0
			if len >= k:
				res += 1
print(res)


from sys import stdin
(a, b, c) = map(int, stdin.readline().split())
d = [0] * b
s = 0
if c == 1:
	s = 0
	for _ in ' ' * a:
		s += stdin.readline().count('.')
	exit(print(s))
for _ in ' ' * a:
	z = stdin.readline()
	k = 0
	for i in range(b):
		if z[i] == '.':
			d[i] += 1
			k += 1
		else:
			s += max(d[i] - c + 1, 0)
			s += max(k - c + 1, 0)
			k = 0
			d[i] = 0
	s += max(k - c + 1, 0)
for i in range(b):
	s += max(d[i] - c + 1, 0)
print(s)


(n, m, k) = map(int, input().split())
M = [input() for i in range(n)]
ans = 0
for i in range(n):
	res = 0
	for j in range(m):
		if M[i][j] == '.':
			res += 1
			if res >= k:
				ans += 1
		else:
			res = 0
for j in range(m):
	ress = 0
	for i in range(n):
		if M[i][j] == '.':
			ress += 1
			if ress >= k:
				ans += 1
		else:
			ress = 0
print(ans if k > 1 else ans // 2)


(y, x, k) = map(int, input().split())
m = []
ans = 0
for i in range(y):
	m.append(list(input()))
	e = 0
	for z in m[i]:
		if z == '.':
			e += 1
		else:
			ans += max(0, e - k + 1)
			e = 0
	ans += max(0, e - k + 1)
if k - 1:
	for j in range(x):
		e = 0
		for i in range(y):
			if m[i][j] == '.':
				e += 1
			else:
				ans += max(0, e - k + 1)
				e = 0
		ans += max(0, e - k + 1)
print(ans)