import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; public class No00000586_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int p1 = Integer.parseInt(br.readLine()); int p2 = Integer.parseInt(br.readLine()); int n = Integer.parseInt(br.readLine()); Set s = new HashSet(); int cnt = 0; for(int i = 0; i < n; i++) { String r = br.readLine(); if(s.contains(r)) { cnt++; } else { s.add(r); } } System.out.println((p1 + p2) * cnt); } }