10 5 1000000000
1 1 1 2 2 1 2 2 2 2
 5 3 3
1 2 2 1 1
 2 4 1
1 1
 1 1000000000 1000000000
100000
 5 3 2
1 1 2 1 1
 5 2 4
1 2 3 2 1
 1 10 10
1

10000000000
 0
 2
 0
 7
 0
 0

from sys import stdin
rr = lambda: stdin.readline().strip()
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
def rry(N = None, f = rri):
    for i in xrange(N or rri()):
        yield f()

from itertools import groupby
debug=0
if debug:
    fi = open('t.txt','r')
    rr = lambda: fi.readline().replace('\n','')
N, K, M = rrm()
A = rrm()


def compress(B):
    ans = []
    nice = False
    for k, v in groupby(B):
        w = list(v)
        a = 0
        while a*K + K <= len(w):
            a += 1
        if a:
            nice = True
            w = w[K*a:]
        ans.extend(w)
    return ans, nice

a = 1
powers = [compress(A)[0]]
while True:
    a *= 2
    if a <= M:
        c, nice = compress(powers[-1] + powers[-1])
        powers.append(c)
        if len(c) > 10*N: break
        #if not nice: break
    else:
        break

ans = 0
make = []
for i,x in enumerate(bin(M)[2:][::-1]):
    if x =='1':
        if i < len(powers):
            make.extend(powers[i])
        else:
            j = len(powers) - 1
            ans += len(powers[-1]) * (2 ** (i-j))

print ans + len(compress(compress(make)[0])[0])
