#include void main(void) { int hotelA = 0 ,hotelB = 0; scanf("%d\n%d\n",&hotelA,&hotelB); int reservation = 0; scanf("%d ",&reservation); int roomNumber[reservation]; for(int i = 0 ; i < reservation;i++){ scanf("%d\n",&reservation); } int loss = 0; for(int i = 0 ; i < reservation;i++){ if(roomNumber[i] == 0){ continue; } for(int j = i ; j < reservation ; j++){ if(roomNumber[i] == roomNumber[j]){ roomNumber[j] = 0; loss += hotelA+hotelB; } } } printf("%d",loss); }