import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int r = scanner.nextInt();
int y = scanner.nextInt();
int g = scanner.nextInt();
int n = scanner.nextInt();
int sum = 0;
for (int i = 0; i < n; i++) {
int a = scanner.nextInt();
int b = scanner.nextInt();
if (a == 0 || a == 1 ){
sum += b;
}
if (a == 2){
sum +=b+r;
}
}
System.out.println(sum);
}
}
CCF(201812-1)——小明上学
最新推荐文章于 2022-12-07 12:46:46 发布