# 50167. E-commerce

## I'm a slow walker, but I never walk backwards.

Write a program to calculate the payment of your order on an online shopping platform. Your order has items you want to buy and the quantity of each item. For each item you first find out its price and multiply the price by the number you buy. Some items are on sale, meaning that they have a 20% discount, so you need to check a table to see if the items are on sale. You then sum up the payment for all items to get the total payment. Finally, if the total payment is less than $\$490.00$, you will have to pay another$\$80$ for shipping, otherwise you get free shipping.

Please write a function to compute the total payment (including the shipping). The prototype of payment.h is as follows.

double payment(int itemID[], double price[], int orderItemID[], int orderQuantity[], int onSaleItemID[]);


Each item has a unique item ID. $itemID$ has the item IDs you can buy, and $price$ has the price of each item in $itemID$. $orderItemID$ has the item IDs in your order. $orderQuantity$ has the number of each item you want to by in $orderItemID$. $onSaleItemID$ has the item IDs that are on sale. All these arrays ends with 0, so you can check the array length by yourself. Your order may be incorrect. That is, there may be some item IDs in $orderItemID$ but not in $itemID$, so you just ignore them in your order.

You can use the following main.c to test your function:

#include <stdio.h>#include "payment.h"#define MAXN 20000 int main(int argc, char const *argv[]){  int itemID[MAXN+1], orderItemID[MAXN+1], orderQuantity[MAXN+1], onSaleItemID[MAXN+1];  double price[MAXN+1];  int itemCnt, orderCnt, onSaleCnt;  scanf("%d%d%d", &itemCnt, &orderCnt, &onSaleCnt);   for(int i = 0; i < itemCnt; i++) {    scanf("%d%lf", &itemID[i], &price[i]);  }  itemID[itemCnt] = 0, price[itemCnt] = 0;   for(int i = 0; i < orderCnt; i++) {    scanf("%d%d", &orderItemID[i], &orderQuantity[i]);  }  orderItemID[orderCnt] = 0, orderQuantity[orderCnt] = 0;   for(int i = 0; i < onSaleCnt; i++) {    scanf("%d", &onSaleItemID[i]);  }  onSaleItemID[onSaleCnt] = 0;   double pay = payment(itemID, price, orderItemID, orderQuantity, onSaleItemID);  printf("%.1lf\n", pay);   return 0;}


## Input Format

The first line has three integers $a$, $b$, $c$. The next $a$ lines are the IDs in $itemID$ and prices in $price$. The next $b$ lines are the IDs in $orderItemID$ and numbers in $orderQuantity$. The next $c$ lines are the IDs in $onSaleItemID$.

• $0\lt a,b,c\lt 20000$

## Output Format

All computation must be in double, and the return value of the function is also double.

## Sample Input

3 2 210435 18.010472 16.011111 200.010435 810472 71043511111


## Sample Output

307.2