#CCBCHBAHAI0000089. Tổng có trọng số theo vị trí
Tổng có trọng số theo vị trí
Position-Weighted Sum
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given , compute the 1-based position-weighted sum
Use a 64-bit accumulator.
Input
The first line contains . The second line contains integers .
Output
Print .
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
4
3 -2 5 1
Output
18
Explanation
The result follows directly from the mathematical definition above.