<p>Given an array <code>arr</code> of positive integers, consider all binary trees such that:</p>
<ul>
<li>Each node has either <code>0</code> or <code>2</code> children;</li>
<li>The values of <code>arr</code> correspond to the values of each <strong>leaf</strong> in an in-order traversal of the tree.</li>
<li>The value of each non-leaf node is equal to the product of the largest leaf value in its left and right subtree, respectively.</li>
</ul>
<p>Among all possible binary trees considered, return <em>the smallest possible sum of the values of each non-leaf node</em>. It is guaranteed this sum fits into a <strong>32-bit</strong> integer.</p>
<p>A node is a <strong>leaf</strong> if and only if it has zero children.</p>