Treating Freshmen to Cafeteria Meals
Time limit1sMemory limit1024 MB
Given N menu prices and M counter choices, the task is to print the sum of the prices each freshman picks.
- Level
Easy1 of 10
- Topics
- Implementation, Array
- Solved
- No attempts yet
Problem
You are a fossil person who has agreed to treat the freshmen who just entered Kookmin University to cafeteria meals. The student cafeteria has several counters, each with its own number, and each counter sells a different meal. The freshmen want many different dishes, so working out the total bill is hard.
Given the price of the menu at each counter and the counter number that sells the meal each freshman wants, print the total amount you must pay.
Input
The first line contains the number of menu items .
The next lines each contain a price. The -th of these lines contains the integer price of the menu sold at the -th counter.
The next line contains the number of freshmen .
The next lines each contain , the number of the counter that sells the meal the -th freshman wants.
Output
Print the total amount you must pay.