Limits: 2s, 512 MB

You are given an array **A** of length **N** consisting of integer numbers. Your task is to determine the value returned by following “**Solve()**” function.

This is a companion discussion topic for the original entry at https://toph.co/p/just-solve-it