CF623B Array GCD
Description
You are given array $ a_{i} $ of length $ n $ . You may consecutively apply two operations to this array:
- remove some subsegment (continuous subsequence) of length $ m
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first sample the optimal way is to remove number $ 3 $ and pay $ 1 $ coin for it.
In the second sample you need to remove a segment $ [17,13] $ and then decrease number $ 6 $ . The cost of these changes is equal to $ 2·3+2=8 $ coins.