Description

Input

Output

Sample Input
3 6 2 21 4 6
Sample Output
1Hint
可以将序列变换为2 4 6或者1 3 5。前者变换代价为1,后者为2。因此最小TransformCost为1。对于10%的数据 , N ≤ 100, Q ≤ 10000, 1≤ A, B ≤ 100。
对于30%的数据 , N ≤ 10000, Q ≤ 10000, 1≤ A, B ≤ 100。
对于60%的数据 , N ≤ 10000, Q ≤ 109, 1≤ A, B ≤ Q。
对于100%的数据, N ≤ 500000, Q ≤ 109, 1≤ A, B ≤ Q。