P9024 [CCC 2021 S1] Crazy Fencing

Description

The fence consists of $N$ wooden boards. Since it is a fence, the height of the right boundary of board $i$ is the same as the height of the left boundary of board $i+1$. You are given the heights of the boundaries of these boards and the widths of the boards. Output the total area of all the boards.

Input Format

The first line contains an integer $N$. The second line contains $N+1$ integers, representing the height of each boundary. The third line contains $N$ integers, representing the width of each board.

Output Format

Output one real number rounded to one decimal place, representing the total area.

Explanation/Hint

Sample explanation: ![](https://cdn.luogu.com.cn/upload/image_hosting/doy8i2lm.png) ![](https://cdn.luogu.com.cn/upload/image_hosting/3q9oe7v5.png) Constraints: $N\leq 10000$, and heights and widths are $\leq 100$. Translated from [CCC2021 S2](https://cemc.math.uwaterloo.ca/contests/computing/past_ccc_contests/2021/ccc/seniorEF.pdf)。 Translated by ChatGPT 5