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.ArrayList;
import java.util.List;
import java.util.Stack;

public class P879D {
    private static class HpReader {
        private BufferedReader in;
        private String containingDirPath;

        public HpReader(String dir, String inFile, String outFile) {
            initAndRedirectInOut(dir, inFile, outFile);
        }

        private static int ivl(String val) {
            return Integer.parseInt(val);
        }

        private static long lvl(String val) {
            return Long.parseLong(val);
        }

        private void initAndRedirectInOut(String dir, String inFile, String outFile) {
            if (dir != null) {
                try {
                    containingDirPath = dir.endsWith(File.separator) ? dir : dir + File.separator;
                    if (isDebug && inFile != null) System.setIn(new FileInputStream(new File(containingDirPath + inFile)));
                    if (isDebug && outFile != null) System.setOut(new PrintStream(new File(containingDirPath + outFile)));
                } catch (FileNotFoundException e) {
                    // Do nothing, stdin & stdout are not redirected
                }
            }
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        private String nextSingleStr() throws IOException {
            return in.readLine();
        }

        private String[] nextLineStr() throws IOException {
            return nextLineStr(0);
        }

        private String[] nextLineStr(int offset) throws IOException {
            String[] inp = nextSingleStr().split(" ");
            String[] rs = new String[offset + inp.length];
            System.arraycopy(inp, 0, rs, offset, inp.length);
            return rs;
        }

        private int nextSingleInt() throws IOException {
            return ivl(in.readLine());
        }

        private int[] nextLineInt() throws IOException {
            return nextLineInt(0);
        }

        private int[] nextLineInt(int offset) throws IOException {
            String[] inp = nextLineStr();
            int[] rs = new int[offset + inp.length];
            for (int i = 0; i < inp.length; i++) rs[offset + i] = ivl(inp[i]);
            return rs;
        }

        private long nextSingleLong() throws IOException {
            return lvl(in.readLine());
        }

        private long[] nextLineLong() throws IOException {
            return nextLineLong(0);
        }

        private long[] nextLineLong(int offset) throws IOException {
            String[] inp = nextLineStr();
            long[] rs = new long[offset + inp.length];
            for (int i = 0; i < inp.length; i++) rs[offset + i] = lvl(inp[i]);
            return rs;
        }

        private int[][] nextMatInt(int lineCount) throws IOException {
            return nextMatInt(lineCount, 0, 0);
        }

        private int[][] nextMatInt(int lineCount, int rowOffset, int colOffset) throws IOException {
            int[][] rs = new int[rowOffset + lineCount][];
            for (int i = rowOffset; i < rs.length; i++) rs[i] = nextLineInt(colOffset);
            return rs;
        }
    }

    private static class HpHelper {
        private static final String LOCAL_DEBUG_FLAG = "COM_PROG_DEBUG";

        private static boolean isDebug() {
            try {
                return Boolean.parseBoolean(System.getenv(HpHelper.LOCAL_DEBUG_FLAG));
            } catch (Exception e) {
                return false;
            }
        }

        private static String createDelimiter(String delimiter) {
            return delimiter == null ? " " : delimiter;
        }

        private static void println(int[] data, String delimiter) {
            delimiter = createDelimiter(delimiter);
            for (int t : data) out.print(t + delimiter);
            out.println();
        }

        private static void println(long[] data, String delimiter) {
            delimiter = createDelimiter(delimiter);
            for (long t : data) out.print(t + delimiter);
            out.println();
        }

        private static <T> void println(T[] data, String delimiter) {
            delimiter = createDelimiter(delimiter);
            for (T t : data) {
                if (t instanceof int[]) {
                    println((int[]) t, delimiter);
                } else if (t instanceof long[]) {
                    println((long[]) t, delimiter);
                } else if (t instanceof Object[]) {
                    println((Object[]) t, delimiter);
                } else {
                    out.print(t + delimiter);
                }
            }
            out.println();
        }
    }

    private static boolean isDebug = HpHelper.isDebug();
    private static HpReader in = new HpReader("/Users/apple/Work/WorkSpaces/CompetitiveProg/", "in.txt", null);
    private static PrintWriter out;

    public static void main(String[] args) throws IOException {
        int[] inp = in.nextLineInt();
        int n = inp[0], k = inp[1], m = inp[2];
        int[] cities = in.nextLineInt();

        long totalPerson = (long) n * m;
        List<Integer> cityId = new ArrayList<>();
        List<Integer> cityPop = new ArrayList<>();
        int cur = 0, curCount = 0, curCity = cities[cur];
        while (cur < cities.length) {
            if (cities[cur] == curCity) {
                curCount += 1;
            } else {
                if (curCount >= k) {
                    totalPerson -= (long) m * (k * (curCount / k));
                    curCount %= k;
                }

                if (curCount > 0) {
                    cityId.add(curCity);
                    cityPop.add(curCount);
                }

                curCity = cities[cur];
                curCount = 1;
            }
            cur += 1;
        }
        cityId.add(curCity);
        cityPop.add(curCount);

        int left = 0, right = cityId.size() - 1;
        int freqRemCount = 0;
        while (left < right) {
//            while (cityPop.get(left) >= k && cityPop.get(left) % k == 0 && left < right) {
//                freqRemCount += cityPop.get(left);
//                left += 1;
//            }
//            while (cityPop.get(right) >= k && cityPop.get(right) % k == 0 && left < right) {
//                freqRemCount += cityPop.get(right);
//                right -= 1;
//            }
            if (cityId.get(left) == cityId.get(right)) {
                int totalPop = cityPop.get(left) + cityPop.get(right);
                freqRemCount += k * (totalPop / k);
                if (totalPop % k != 0) break;
                else {
                    left += 1;
                    right -= 1;
                }
            } else {
                break;
            }
        }

        if (left != right) {
            out.println(totalPerson - (long) freqRemCount * (m - 1));
        } else {
            Stack<Integer> stk = new Stack<>();
            int turnCount = cityPop.get(left);
            while (m > 1) {
                if (m % 2 == 1) {
                    stk.push(turnCount);
                }

                totalPerson -= (long) freqRemCount * (m / 2);
                int midTurnCount = 2 * turnCount;
                totalPerson -= (long) k * (midTurnCount / k) * (m / 2);
                turnCount = midTurnCount % k;

                m /= 2;
            }
            while (!stk.isEmpty()) {
                int prevTurnCount = stk.pop();

                totalPerson -= freqRemCount;
                turnCount = turnCount + prevTurnCount;
                totalPerson -= k * (turnCount / k);
                turnCount %= k;
            }
            if (turnCount == 0) totalPerson -= freqRemCount;
            out.println(totalPerson);
        }

        out.flush();
    }
}
