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

import java.io.*;
import java.util.*;

public class pr1 {
	
	public static void main(String[] args) throws NumberFormatException, IOException {
		/*BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		String str = "";*/
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int m = sc.nextInt();
		int[] q = new int[n];
		ArrayList<Integer> qL = new ArrayList();
		int cur = 0;
		int score = 0;
		for(int i = 0;i<n;i++) {
			q[i]=sc.nextInt();
			if(i==0){
				cur = q[i];
				score = 1;
			} else {
				if(q[i]==cur) {
					score++;
					if(score==k) {
						score=0;
					}
				} else {
					cur = q[i];
					if(score<k) {
						for(int j = i-score;j<i;j++) {
							qL.add(q[j]);
						}
					}
					score = 1;
				}
			}
		}
		if(score<k) {
			for(int j = q.length-score;j<q.length;j++) {
				qL.add(q[j]);
			}
		}
		if(m==1) {System.out.println(qL.size());}
		else if(qL.size()==1) {
			while(m>k) {
				m-=k;
			} 
			System.out.println(m);
		}
		else if(qL.get(0)!=qL.get(qL.size()-1)) {
			System.out.println(n*m);
		} else {
			int skf = 0;
			if(qL.size()%2==0)skf=qL.size()/2;
			else skf=qL.size()/2+1;
			for(int i=1;i<skf;i++) {
				if(qL.get(i)!=qL.get(qL.size()-i)) {
					if(i!=qL.size()-i-1) {
						if(m==2) {
							System.out.println((qL.size()-i)*2);
						} else {
							System.out.println((qL.size()-i)*2+((qL.size()-(i*2))*(m-2)));
						}
					} else {
						while(m>=k) {
							m-=k;
						} 
						System.out.println(m);
					}
				}
			}
			
		}
	}
}

