#P9607. [CERC2019] Be Geeks!
[CERC2019] Be Geeks!
Background
This problem is translated from CERC 2019 “Be Geeks!”.
Problem Description
The music band Be Geeks! did not get its name by accident, because all members are true math geeks. Besides that, they like to study various properties of sequences. Here is an example they are interested in:
- Let be a non-empty sequence of positive integers, .
- , where .
- , where .
- , where .
- .
Given a sequence , you need to compute .
Input Format
The first line contains an integer , which is the length of sequence .
The second line contains integers , representing the sequence .
Output Format
Output one integer, which is the value of .
4
1 2 3 4
50
5
2 4 6 12 3
457
Hint
Translated by ChatGPT 5