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;
const int N = 1e5 + 10;
int n, m, k;
int a[N], f[N];
int main() {
  cin >> n >> k >> m;
  long long total = 1LL * n * m, out = 0;
  for (int i = 1, cur = 0; i <= n; i++) {
    cin >> a[i];
    if (a[i] == a[i - 1])
      f[i] = f[i - 1] + 1;
    else
      f[i] = 0;
    if (f[i] >= k) {
      out += 1LL * k * m;
      i -= k;
      n -= k;
    }
  }
  int L = 1, R = n;
  while (L <= R && a[L] == a[R]) {
    int n1 = 0;
    while (L + n1 <= R && a[L + n1] == a[L]) n1++;
    if (n1 == R - L + 1) {
      cout << 1LL * (R - L + 1) * m % k;
      return 0;
    }
    int n2 = 0;
    while (a[R - n2] == a[R]) n2++;
    if (n1 + n2 < k)
      break;
    else {
      int use = n1 + n2 - (n1 + n2) % k;
      int useL = min(use, n1);
      out += 1LL * use * (m - 1);
      L += useL;
      use -= useL;
      R -= use;
    }
  }
  cout << total - out;
}
