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 MOD = (int)1e9 + 7;
const int FFTMOD = 1007681537;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
const int maxn = 1e5 + 5;
int n, k, m;
int a[maxn];
void go(vector<int>& vals, long long& tot) {
  tot = 0;
  int st = 0;
  vector<pair<int, int> > tmp;
  for (int i = (0); i < (int((vals).size())); i++) {
    if (i == int((vals).size()) - 1 || vals[i] != vals[i + 1]) {
      int len = i - st + 1;
      tot += len / k;
      len %= k;
      if (len) {
        if (int((tmp).size()) && tmp.back().first == vals[i]) {
          tmp.back().second += len;
          tot += tmp.back().second / k;
          tmp.back().second %= k;
          if (!tmp.back().second) tmp.pop_back();
        } else {
          tmp.push_back(make_pair(vals[i], len));
        }
      }
      st = i + 1;
    }
  }
  vals.clear();
  for (int i = (0); i < (int((tmp).size())); i++) {
    for (int j = (0); j < (tmp[i].second); j++) {
      vals.push_back(tmp[i].first);
    }
  }
}
void shorten(vector<int>& vals) {
  if (int((vals).size()) > n * 4) {
    vector<int> nvals;
    for (int i = (0); i < (n * 2); i++) {
      nvals.push_back(vals[i]);
    }
    nvals.push_back(-1);
    for (int i = (n * 2) - 1; i >= (0); i--) {
      int j = int((vals).size()) - i - 1;
      nvals.push_back(vals[j]);
    }
    vals = nvals;
  }
}
long long divide(vector<int>& vals, int m) {
  if (!m) {
    vals.clear();
    return 0;
  }
  long long res = 0;
  if (m == 1) {
    go(vals, res);
    return res;
  }
  if (m & 1) {
    vector<int> tmp = vals;
    long long a = divide(vals, m - 1);
    long long b = divide(tmp, 1);
    res += a + b;
    vals.insert(vals.end(), (tmp).begin(), (tmp).end());
    long long c;
    go(vals, c);
    res += c;
    shorten(vals);
    return res;
  }
  long long a = divide(vals, m >> 1);
  res += a + a;
  vals.insert(vals.end(), (vals).begin(), (vals).end());
  long long c;
  go(vals, c);
  res += c;
  shorten(vals);
  return res;
}
void solve() {
  cin >> n >> k >> m;
  for (int i = (0); i < (n); i++) cin >> a[i];
  if (*min_element(a, a + n) == *max_element(a, a + n)) {
    cout << (long long)n * m % k << "\n";
    return;
  }
  if (k > n + n) {
    cout << (long long)n * m << "\n";
    return;
  }
  vector<int> vals;
  for (int i = (0); i < (n); i++) vals.push_back(a[i]);
  cout << (long long)n * m - divide(vals, m) * k << "\n";
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int JUDGE_ONLINE = 1;
  if (argc > 1) {
    JUDGE_ONLINE = 0;
    assert(freopen(argv[1], "r", stdin));
  }
  if (argc > 2) {
    JUDGE_ONLINE = 0;
    assert(freopen(argv[2], "w", stdout));
  }
  solve();
  if (!JUDGE_ONLINE) {
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  }
  return 0;
}
