#P1897. 电梯里的尴尬

电梯里的尴尬

Background

Careful students have noticed that lately, Xiao W likes to ride the elevator up and down. As for the reason, perhaps only Xiao W knows: in the elevator, he often runs into the OI “da shen” lxl in his heart.

The elevator is actually a magical place. Only in the elevator does Xiao W have the courage to get so close to the “da shen.” Although he feels a bit uneasy, after many encounters, the “da shen” has gotten used to Xiao W’s presence, even to the point where it feels inappropriate not to say something. However, their conversation is limited to things like “Nice weather today” or “Have you eaten?”, and often, after a polite smile and nod, they fall back into an awkward silence.

Problem Description

So, while trying to strike up a conversation with the “da shen,” Xiao W also watches the floor number displayed in the elevator. He notices that going up one floor takes 66 seconds, going down one floor takes 44 seconds, each door opening takes 55 seconds (only if someone arrives and the elevator stops), and each person getting off adds 11 second.

It is specifically stated that the elevator starts on floor 00, and it must return to floor 00 at the end for the trip to be considered finished. Assuming that at the beginning we know the destination floor of every person currently inside the elevator, can you compute the total time needed to complete this trip?

This is a very simple problem. You should know that Xiao W has already trained himself to quickly do the mental arithmetic. Now you try to program it!

Input Format

There are 22 lines.

The first line contains a positive integer nn, the number of people riding the elevator.

The second line contains nn positive integers. aia_{i} denotes the destination floor of the ii-th person.

Output Format

Output one line containing a positive integer — the time needed to complete this trip.

4
2 4 3 2 
59

Hint

For 60%60\% of the testdata, 0<n<1040<n<10^4.

For 100%100\% of the testdata, 0<n<1050<n<10^5, 0<ai2×1070<a_{i}\leq 2\times 10^7.

Translated by ChatGPT 5