Game
Can you think of anyone you knew by the age of twenty who didn't play computer games as a child? If so, maybe you're not familiar with this pastime yourself. However, this shouldn't pose any difficulty in solving this problem.
In many classic games with two-dimensional graphics, you might encounter a scenario like this: A Hero jumps across platforms (or small islands) suspended in the air. The goal is to move from one side of the screen to the other. When the Hero jumps from one platform to an adjacent one, he expends |y_2-y_1| units of Energy, where y_1 and y_2 are the heights of these platforms. Additionally, the Hero has a Supermove that allows him to skip a platform, but this costs 3*|y_3-y_1| units of Energy. Naturally, the Energy should be used as efficiently as possible.
Given the coordinates of all platforms in sequence from the left edge to the right, can you determine the minimum amount of Energy the Hero needs to travel from the first platform to the last?
Input
The first line of the input specifies the number of platforms n (1 ≤ n ≤ 30000). The second line contains n natural numbers, each not exceeding 30000, representing the heights of the platforms.
Output
Output a single number - the minimum amount of Energy the player must spend to traverse the platforms (assuming, of course, that cheat codes are not an option).