AT_abc431_b [ABC431B] Robot Weight
Description
There is a robot, and initially the weight of the robot is $ X $ . This robot has $ N $ types of parts that can be attached simultaneously: type $ 1, $ type $ 2,\ldots, $ type $ N $ . The weight of the type $ i\ (1\le i\le N) $ part is $ W _ i $ . Initially, none of the $ N $ types of parts are attached to the robot.
Process the following $ Q $ queries in order. The $ i $ -th query $ (1\le i\le Q) $ is represented by an integer $ P _ i $ and is as follows:
- If the type $ P _ i $ part is not currently attached to the robot, attach it; if it is attached, remove it. Then, print the current weight of the robot.
Input Format
The input is given from Standard Input in the following format:
> $ X $ $ N $ $ W _ 1 $ $ W _ 2 $ $ \ldots $ $ W _ N $ $ Q $ $ P _ 1 $ $ P _ 2 $ $ \vdots $ $ P _ Q $
Output Format
Output $ Q $ lines. The $ i $ -th line $ (1\le i\le Q) $ should contain the result of processing the $ i $ -th query.
Explanation/Hint
### Sample Explanation 1
Initially, the weight of the robot is $ 31 $ . For each query, the weight of the robot becomes as follows:
- In the $ 1 $ -st query, attach the type $ 3 $ part to the robot. The weight of the robot becomes $ 31+65=96 $ .
- In the $ 2 $ -nd query, attach the type $ 1 $ part to the robot. The weight of the robot becomes $ 96+15=111 $ .
- In the $ 3 $ -rd query, attach the type $ 4 $ part to the robot. The weight of the robot becomes $ 111+35=146 $ .
- In the $ 4 $ -th query, remove the type $ 1 $ part from the robot. The weight of the robot becomes $ 146-15=131 $ .
### Constraints
- $ 1\le X\le100 $
- $ 1\le N\le100 $
- $ 1\le W _ i\le100\ (1\le i\le N) $
- $ 1\le Q\le100 $
- $ 1\le P _ i\le N\ (1\le i\le Q) $
- All input values are integers.