#M1001. Buy Clothes
Buy Clothes
Buy Clothes
Background of the topic
Little P opened a clothing store and bought a lot of goods...
Description
P buys pieces of clothing for yuan each, but will get , but only by selling it. There are minutes, and someone may come to see the clothes every minute, as we all know, to look at the clothes, to touch the clothes, each touch will reduce the completeness of , let the remaining completeness be , then the net profit is .
Input format
Enter on the first line.
The second line .
The third line .
The fourth line counts, and in the minute a person touches the piece of clothing, and if is , no one comes to see the clothes.
Output Format
Output total net profit.
Sample
Sample #1输入
2 2
1 1
5 4
1 0
Sample #1输出
6
Data Conventions
For data of : $1\leqslant n\leqslant100,1\leqslant t\leqslant 100\times n-10,1\leqslant a_i,b_i\leqslant1000,1\leqslant c_i\leqslant n$.