这个题很简单,不多说了。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r = sc.nextInt(), y =sc.nextInt(), g = sc.nextInt();
int n = sc.nextInt(), Sum = 0;
for(int i=0;i<n;i++) {
int flag = sc.nextInt(), time = sc.nextInt();
if(flag == 0)
Sum += time;
else if(flag == 1)
Sum += time;
else if(flag == 2)
Sum += (time+r);
}
System.out.println(Sum);
}
}