n, m = map(int, input().split()) A = [0] * n B = [0] * n for i in range(n): A[i], B[i] = map(int, input().split()) Q, x = map(int, input().split()) C = list(map(int, input().split())) def f(i, x): a, b = A[i], B[i] x -= a if b == 0: return abs(x) * m p = x // b if p < 0: return m * (b * (m - 1)) // 2 - x * m elif p >= m: return x * m - m * (b * (m - 1)) // 2 else: ret = x * (p + 1) - (p + 1) * (b * p) // 2 ret += (m - 1 - p) * (b * (p + 1) + b * (m - 1)) // 2 - x * (m - 1 - p) return ret P = [0] thr = [] i = 1 while i < n: bi = P[-1] l = A[bi] r = A[i] + B[i] * (m - 1) while r - l > 1: mid = (l + r) // 2 if f(bi, mid) > f(i, mid): r = mid else: l = mid if not thr or thr[-1] < r: P.append(i) thr.append(r) i += 1 else: P.pop() thr.pop() p = 0 ans = [] for _ in range(Q): while p < len(P) - 1 and x >= thr[p]: p += 1 ans.append(P[p] + 1) x += C[P[p]] print(*ans)