#C8409. Total Tree Height Calculation

    ID: 52388 Type: Default 1000ms 256MiB

Total Tree Height Calculation

Total Tree Height Calculation

You are given a collection of trees. For each tree, you are provided its initial height and its daily growth rate. Your task is to calculate the total height of all trees after a given number of days.

Let \( H_i \) be the initial height of the \( i \)-th tree and \( G_i \) be its daily growth rate. After \( d \) days, the height of tree \( i \) becomes \( H_i + d \times G_i \). The overall total height is:

[ Total = \sum_{i=1}^{n} (H_i + d \times G_i) ]

Input will be provided in the standard input (stdin) and output should be written to the standard output (stdout).

inputFormat

The first line contains a single integer \( n \), the number of trees.

The second line contains \( n \) space-separated integers representing the initial heights \( H_1, H_2, \ldots, H_n \) of the trees.

The third line contains \( n \) space-separated integers representing the daily growth rates \( G_1, G_2, \ldots, G_n \) of the trees.

The fourth line contains a single integer \( d \), representing the number of days.

outputFormat

Output a single integer representing the total height of all trees after \( d \) days.

## sample
3
2 3 1
1 2 1
5
26