#include <bits/stdc++.h>
using namespace std;
const int maxn = 1003;
int a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int l;
  scanf("%d", &l);
  int q;
  scanf("%d", &q);
  while (q--) {
    int a1, b;
    scanf("%d%d", &a1, &b);
    int ans = 0;
    int cou = 0;
    if (a1 <= b) {
      ans = 0;
      ans -= a1;
      for (int i = a1 + 1; i <= b; i++) {
        if (ans >= l) {
          cou++;
          ans = 0;
        }
        ans += a[i];
      }
      printf("%d\n", cou == 0 ? 1 : cou);
    } else {
      ans -= a1;
      swap(a1, b);
      for (int i = a1 + 1; i <= b; i++) {
        if (ans >= l) {
          cou++;
          ans = 0;
        }
        ans += a[i];
      }
      printf("%d\n", cou == 0 ? 1 : cou);
    }
  }
  return 0;
}
