#P9280. [AGM 2023 资格赛] Monty Hall
[AGM 2023 资格赛] Monty Hall
Problem Description
Monty Hall is a game show host. One day, he decided to introduce a new game.
There are a total of doors arranged in a circle. The player is initially standing in front of door . In each round, the player performs the following operations: choose an integer , pay a cost of to move steps to the right, and then the player opens the door at their current position. In particular, it is guaranteed that .
The player wants to know the minimum total cost needed to open all doors.
Input Format
The first line contains an integer .
The next line contains integers .
Output Format
One integer, representing the answer.
5
4 3 3 3 3
15
Hint
Translated by ChatGPT 5