You want to insert one new object into a sorted array, and you find the insertion position by binary search. Comparing the new object with an object of the array answers either "greater" or "less". "Greater" means the new object goes to the right of the compared object, and "less" means it goes to the left. A comparison never answers "equal" in this problem.
The answers never contradict each other. If the new object is greater than some object of the array, it is also greater than every object to the left of that one. If it is less than some object, it is also less than every object to the right of that one. For an array of n elements there are n+1 possible insertion positions.
Comparisons do not all cost the same. Comparing the new object with the i-th object of the array costs ai, an integer between 1 and 9.
You may pick the next object to compare after seeing the answers so far. Play a strategy that minimizes the total cost in the worst case, and report that worst-case total cost.