#include <iostream>
using namespace std;
int n, m;
struct point
{
int x;
int y;
char t;
point (int x_,int y_,char t_):x(x_),y(y_),t(t_){}
}p1[1001],p2[1001];
int judge(point a, int q0, int q1,int q2)
{
if ((q0 + q1 * a.x + q2 * a.y) > 0)return 1;
else return -1;
}
int main()
{
cin >> n >> m;
int x1, y1;
char t1;
int p1n=0, p2n = 0;
for (int i = 0; i < n; i++)
{
cin >> x1 >> y1 >> t1;
if (t1 == 'A')
{
p1[p1n].x = x1;
p1[p1n].y = y1;
p1[p1n].t = t1;
p1n++;
}
else {
p2[p2n].x = x1;
p2[p2n].y = y1;
p2[p2n].t = t1;
p2n++;
}
}
int q0, q1, q2;
for(int n=0;n<m;n++)
{
scanf_s("%d %d %d", &q0, &q1, &q2);
if (judge(p1[0], q0, q1, q2) > 0)
{
int i, j;
for (i = 1; i < p1n; i++)
{
if (judge(p1[i], q0, q1, q2) < 0)break;
}
for (j = 0; j < p2n; j++)
{
if (judge(p2[j], q0, q1, q2) > 0)break;
}
if (i == p1n && j == p2n)printf("Yes\n");
else printf("No\n");
}
if (judge(p1[0], q0, q1, q2) < 0)
{
int i, j;
for (i = 1; i < p1n; i++)
{
if (judge(p1[i], q0, q1, q2) > 0)break;
}
for (j = 0; j < p2n; j++)
{
if (judge(p2[j], q0, q1, q2) < 0)break;
}
if (i == p1n && j == p2n)printf("Yes\n");
else printf("No\n");
}
}
return 0;
}
#include <iostream>
using namespace std;
const int max = 500001;
int u[500010][2], v[500010][2];
int main()
{
ios::sync_with_stdio(false);
int n, a, b;
cin >> n >> a >> b;
for (int i = 0; i < a; i++)
{
cin >> u[i][0] >> u[i][1];
}
for (int i = 0; i < b; i++)
{
cin >> v[i][0] >> v[i][1];
}
long long sum = 0;
int i=0, j=0;
while (i < a&&j < b)
{
if (u[i][0] < v[j][0])
{
i++;
}
else if (u[i][0] > v[j][0])
{
j++;
}
else {
sum += u[i][1] * v[j][1];
i++;
j++;
}
}
printf("%lld", sum);
return 0;
}