Hey guys, here is task number \(\boxed{2}\)!

As you can see, the name of this is CASHIER.

Plarry the Dinosaur has finally found a job as a cashier! (yay) However, the thing is, he is terrible at mental sum and wants you to write a code to help him in calculating the cost of items.

**Input Details**:

First line inputs *n*.

Next n lines input the cost of the *i*th item.

This line inputs *x*.

The next **x** lines are the items the purchaser bought, the number **i** representing the *i*th item.

**Output Details**:

The total cost of all the items.

**Sample input:**

3

0.25

5.67

10.01

2

3

1

**Sample output**:

10.26

**Explanation for output**:

The 1st item costs 0.25 dollars and the 3rd item costs 10.01 dollars. Thus, the total cost is 10.26 dollars.

## Comments

Sort by:

TopNewestMy solution in

## C++

Log in to reply

My solution in

## Java

Log in to reply

And here is python2 solution below:

Log in to reply

sorry ur the only one who tried this daniel XD anyway my solution:

Log in to reply

– Daniel Lim · 2 years, 11 months ago

maybe no one saw this postLog in to reply