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

#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
template <class T>
inline void rea(T &x) {
  char c = nc();
  x = 0;
  for (; c > '9' || c < '0'; c = nc())
    ;
  for (; c >= '0' && c <= '9'; x = x * 10 + c - '0', c = nc())
    ;
}
inline int rea(char *x, int L = 'a', int R = 'z') {
  char c = nc();
  int len = 0;
  for (; c > R || c < L; c = nc())
    ;
  for (; c >= L && c <= R; x[++len] = c, c = nc())
    ;
  return len;
}
const int N = 100010, P = 1e9 + 7;
int n, k, m, a[N];
int main() {
  rea(n);
  rea(k);
  rea(m);
  int ss = 1;
  for (int i = 1; i <= n; i++) {
    rea(a[i]);
    if (i != 1 && a[i] != a[i - 1]) ss = 0;
  }
  if (ss) return printf("%lld\n", 1LL * n * m % k), 0;
  int l = 1, r = n;
  long long ans = 1LL * m * n;
  int cc = 0;
  while (l <= r) {
    if (l == r) {
      if (m % k == 0)
        ans = cc % k;
      else
        ans -= m - m % k;
      break;
    }
    int cnt = 2, i = l;
    if (a[l] != a[r]) break;
    while (a[i + 1] == a[l] && i + 1 < r) {
      i++, cnt++;
      if (l == 1 && r == n) cc++;
    }
    l = i + 1;
    i = r;
    while (a[i - 1] == a[r] && i - 1 > l) {
      i--, cnt++;
      if (l == 1 && r == n) cc++;
    }
    r = i - 1;
    if (cnt % k) {
      ans -= 1LL * (m - 1) * (cnt - cnt % k);
      break;
    }
    ans -= 1LL * (m - 1) * cnt;
  }
  cout << ans << endl;
  return 0;
}
