Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/massiv-skalyar-kopaytma

Dot product

Easy 1000 ms 64 MB 22%
Share

Two arrays of the same length are given: $a_{1}, \dots, a_{n}$ and $b_{1}, \dots, b_{n}$. Find their dot product — $a_{1} b_{1} + a_{2} b_{2} + \dots + a_{n} b_{n}$.

Two arrays one above the other; elements at the same places are multiplied in pairs and added up

Input

The first line contains a positive integer $n$.
The second line contains $n$ integers — the array $a$.
The third line contains $n$ integers — the array $b$.

Output

One integer — the dot product.

Note

$1 \le n \le 1000$
the elements are from $-10^{6}$ to $10^{6}$

Examples

Input #1
3
1 2 3
4 -5 6
Output #1
12
Input #2
1
-7
8
Output #2
-56

Sign in to submit a solution

Signing up is free and takes a minute.