fin = open("fisher.txt", "r")
fout = open("fisher.out", "w")
n, m, p = [int(x) for x in fin.readline().split()]
summ = 0
money = 0
a = []
for i in range(n):
    x, y = [int(x) for x in fin.readline().split()]
    summ += y
for i in range(m):
    x, y, z = [int(x) for x in fin.readline().split()]
    a.append([z, y])
a.sort()
i = len(a) - 1
while i >= 0 and summ > 0:
    if summ > a[i][1]:
        summ -= a[i][1]
        money += a[i][0] * a[i][1]
    else:
        money += summ * a[i][0]
        summ = 0
    i -= 1
print(money, file=fout)
fin.close()
fout.close()