Mirko writes N numbers on a very long sheet of paper. Slavko then takes a pencil and crosses out some of them. Every number that is not crossed out is copied to a new sheet in the original order, and Slavko's score is the sum of the products of each pair of neighboring numbers on the new sheet.
For example, if the copied sequence is 3,6,−1,2, then the score is 3×6+6×(−1)+(−1)×2=10. If fewer than two numbers are copied, the score is 0.
Slavko does not know which numbers to cross out to reach the highest score. Write a program that finds the largest score Slavko can reach. There is no limit on how many numbers he crosses out.