There are frogs in a row. Each frog has an integer value (possibly negative or zero) associated with it. Any frog can eat its adjacent frog (the closest frog to its left or to its right, assuming that this frog exists). When a frog with a value eats a frog with a value , the eaten frog disappears, and the value of the remaining frog changes to .
The frogs will eat each other until there is only one frog left.
Can you give a formula(based on the initial values) to obtain the maximum possible value of the last frog.
Assume the initial values to be .
Say , and the values of the frogs are . Then the maximum possible value of the last frog is 4.
A possible way of getting the last frog with value 4 is:
This problem is a part of Tessellate S.T.E.M.S (2019)