#include #include #include using namespace std; const int maxx=1001, maxy=1001; int b[maxx+2][maxy+2]; int main() { int n, k; while (~scanf("%d%d", &n, &k)) { memset(b, 0, sizeof(b)); vector> v; while (n--) { int x, y, hp; scanf("%d%d%d", &x, &y, &hp); x+=500, y+=500; v.emplace_back(x, y, hp); } while (k--) { int x, y, w, h, d; scanf("%d%d%d%d%d", &x, &y, &w, &h, &d); x+=500, y+=500; #define min(a, b) (a0) res+=hp+b[x][y]; } printf("%d\n", res); } }