#arc060c. [arc060_c]Tak and Hotels

[arc060_c]Tak and Hotels

Problem Statement

NN hotels are located on a straight line. The coordinate of the ii-th hotel (1leqileqN)(1 \\leq i \\leq N) is xix_i.

Tak the traveler has the following two personal principles:

  • He never travels a distance of more than LL in a single day.
  • He never sleeps in the open. That is, he must stay at a hotel at the end of a day.

You are given QQ queries. The jj-th (1leqjleqQ)(1 \\leq j \\leq Q) query is described by two distinct integers aja_j and bjb_j. For each query, find the minimum number of days that Tak needs to travel from the aja_j-th hotel to the bjb_j-th hotel following his principles. It is guaranteed that he can always travel from the aja_j-th hotel to the bjb_j-th hotel, in any given input.

Constraints

  • 2leqNleq1052 \\leq N \\leq 10^5
  • 1leqLleq1091 \\leq L \\leq 10^9
  • 1leqQleq1051 \\leq Q \\leq 10^5
  • 1leqxi<x2<...<xNleq1091 \\leq x_i < x_2 < ... < x_N \\leq 10^9
  • xi+1xileqLx_{i+1} - x_i \\leq L
  • 1leqaj,bjleqN1 \\leq a_j,b_j \\leq N
  • ajneqbja_j \\neq b_j
  • N,,L,,Q,,xi,,aj,,bjN,\\,L,\\,Q,\\,x_i,\\,a_j,\\,b_j are integers.

Partial Score

  • 200200 points will be awarded for passing the test set satisfying Nleq103N \\leq 10^3 and Qleq103Q \\leq 10^3.

Input

The input is given from Standard Input in the following format:

NN x1x_1 x2x_2 ...... xNx_N LL QQ a1a_1 b1b_1 a2a_2 b2b_2 : aQa_Q bQb_Q

Output

Print QQ lines. The jj-th line (1leqjleqQ)(1 \\leq j \\leq Q) should contain the minimum number of days that Tak needs to travel from the aja_j-th hotel to the bjb_j-th hotel.


Sample Input 1

9
1 3 6 13 15 18 19 29 31
10
4
1 8
7 3
6 7
8 5

Sample Output 1

4
2
1
2

For the 11-st query, he can travel from the 11-st hotel to the 88-th hotel in 44 days, as follows:

  • Day 11: Travel from the 11-st hotel to the 22-nd hotel. The distance traveled is 22.
  • Day 22: Travel from the 22-nd hotel to the 44-th hotel. The distance traveled is 1010.
  • Day 33: Travel from the 44-th hotel to the 77-th hotel. The distance traveled is 66.
  • Day 44: Travel from the 77-th hotel to the 88-th hotel. The distance traveled is 1010.