import sys
definput2num():returnmap(int,input().split())
dim, cap_a, cap_b = input2num()
a ={}
tol =0for line in sys.stdin.readlines():
i, n =map(int, line.split())if cap_a >0:
a[i]= n
cap_a -=1else:if i in a:
tol += n * a[i]print(tol)
import sys
n, a, b =tuple(map(int,input().split()))
vector =list(map(int,sys.stdin.read().split()))
i =0
j =0
s =0while i<a and j<b:if vector[i*2]== vector[(a+j)*2]:
s += vector[i*2+1]*vector[(a+j)*2+1]
i+=1
j+=1elif vector[i*2]< vector[(a+j)*2]:
i+=1else:
j+=1print(s)