#P9024. [CCC 2021 S1] Crazy Fencing

[CCC 2021 S1] Crazy Fencing

Problem Description

The fence consists of NN wooden boards.

Since it is a fence, the height of the right boundary of board ii is the same as the height of the left boundary of board i+1i+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 NN.

The second line contains N+1N+1 integers, representing the height of each boundary.

The third line contains NN integers, representing the width of each board.

Output Format

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

3
2 3 6 2
4 1 1

18.5
4
6 4 9 7 3
5 2 4 1

75.0

Hint

Sample explanation:

Constraints: N10000N\leq 10000, and heights and widths are 100\leq 100.

Translated from CCC2021 S2

Translated by ChatGPT 5