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>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
vector<pair<int, long long int>> bl;
const int N = 1e5 + 100;
int a[N];
int main() {
  long long int n, k, m;
  scanf("%lld%lld%lld", &n, &k, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int c = 1, g = 0;
  for (int i = 0; i < n; i++, c++) {
    if (a[i + 1] != a[i]) {
      bl.push_back({a[i], c % k});
      g += c / k;
      c = 0;
    }
  }
  if (bl.size() == 1) {
    printf("%lld", n * m % k);
    return 0;
  }
  int w = 0;
  for (int i = 0; i < bl.size(); i++) {
    if (bl[i].first != bl[n - 1 - i].first) break;
    int t = bl[i].second + bl[n - 1 - i].second;
    w += t / k;
    if (t % k) break;
  }
  if (w * k == 2 * (n - g)) {
    printf("0");
  } else {
    printf("%lld", n * m - (m - 1) * w * k - g * k * m);
  }
  return 0;
}
