For each test case, print the smallest number of years in which erosion could take the mountains from heights $p_1, p_2, \ldots, p_n$ to heights $h_1, h_2, \ldots, h_n$, or a single integer $-1$ if the described model is unsound.