n, m, d = gets.split.map(&:to_i)
a = (1..n).map { gets.chomp }
f = -> a { a.map {|l| l.split(?#).map {|s| [s.size - d + 1, 0].max}}.flatten.inject(:+) }
c = f[a]
a = a.map {|l| l.split("")}.transpose.map(&:join)
p c + f[a]
