n, m = map(int, input().split())
r = float(input())
sd = []
sw = []
for i in range(n):
    d, w = map(int, input().split())
    sd.append(d)
    sw.append(w)

s = []
x = []
x.append(0)
f = [int(i) for i in input().split()]
for i in range(max(f) + 1):
    print(i, x)
    if i in sd:
        x.append((1 - r)x[-1] + rsw[sd.index(i)])
    else:
        x.append(x[-1]r)

for i in range (len(f)):
    if x[f[i] + 1] 10 % 10 == 0:

        print(int(x[f[i] + 1]))
    else:
        print(x[f[i] + 1])