P13008 【MX-X13-T3】"KDOI-12" Only by Losing Light Can You Escape Darkness
Description
Given a non-negative integer $x$, you need to transform it into $y$ through a series of operations with the minimum cost. Each operation is defined as follows:
* Choose an integer $0 \leq i \leq k$, and pay a cost of $a_i$ to either add or subtract $2^i$ from $x$.
**Note: You do not need to ensure that $x$ remains non-negative during the operations.**
Input Format
For each test case, output a single non-negative integer—the minimum cost required to transform $x$ into $y$.
Output Format
For each test case, output a single non-negative integer—the minimum cost required to transform $x$ into $y$.
Explanation/Hint
### **Sample Explanation**
For the second test case in the sample input, the following two operations transform $x$ into $y$ with the minimum cost:
1. Choose $i=2$, perform $x \gets x + 2^2$, resulting in $x=6$ with a cost of $2$.
2. Choose $i=0$, perform $x \gets x - 2^0$, resulting in $x=5$ with an additional cost of $2$, totaling $4$.
### **Data Range**
**This problem uses bundled testing.**
| Subtask | Points | $T \leq$ | $x, y