#P340. 【例58.3】 电梯运行时间
【例58.3】 电梯运行时间
Description
The elevator takes seconds to go up one floor, seconds to go down one floor, seconds to open the door once (only if someone is arriving), and an additional second for each person to exit.
It is specifically noted that the elevator starts at the th floor and must return to the th floor to complete a task. Assuming that the floor each person in the elevator wants to go to is known at the start, can you calculate the total time required to complete this task?
Input Format
The first line contains a positive integer (), representing the number of people in the elevator.
The second line contains positive integers, (), representing the floor the -th person wants to go to.
Output Format
A single line containing a positive integer, representing the total time required to complete the task.
Sample
4
3 7 3 189
Related
In following homework: