n, m, k = map(int, input().split())
D = [0] * (k+1)
for _ in range(n):
    grzadka = input()
    z = [i for i, c in enumerate(grzadka) if c=='x']
    l = len(z)
    if l==0: continue #nie obsługujemy pustych grządek
    p = [1+min(z[i+j]-z[i] for i in range(l-j)) 
        for j in range(min(0, l-k), l)]
    p.reverse()
    p.append(0)
    D = [min(D[i-s]+p[s] for s in range(min(i,l)+1))
        for i in range(k+1)]
    #alternatywnie zamiast powyższej linii można wykonać:
    #for i in range(k, -1, -1):
    #    D[i] = min(D[i-s]+p[s] for s in range(min(i,l)+1))
print(D[-1])