#K71687. Total Lights on the Ziggurat Levels
Total Lights on the Ziggurat Levels
Total Lights on the Ziggurat Levels
You are given an integer N representing the number of levels in a ziggurat. For each level i (1-indexed), you are provided with two integers, Ai and Bi. The number of lights that will be turned on in the i-th level is calculated using the formula:
$$A_i\times B_i^i$$
Your task is to compute the total number of lights that will be on across all levels of the ziggurat.
Example: For N = 3
and levels: (2, 3), (1, 2), (4, 1)
, the total number of lights is computed as:
$$2\times3^1 + 1\times2^2 + 4\times1^3 = 6+4+4 = 14$$
inputFormat
The first line contains a single integer N, the number of levels.
Each of the next N lines contains two space-separated integers Ai and Bi for the i-th level.
outputFormat
Output a single integer representing the total number of lights that are on across all levels of the ziggurat.
## sample3
2 3
1 2
4 1
14