#include #include using namespace std; using i64 = long long; class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x ps; vector> dp; double calc_speed(int mask) { double weight = 0; for(int i : range(n)) { if(mask>>i & 1) { weight += ps[i].w; } } return 120. / (weight + 100); } int dist(point p, point q) { return abs(p.x - q.x) + abs(p.y - q.y); } int main(void) { int x0, y0; scanf("%d%d", &x0, &y0); scanf("%d", &n); n += 1; ps.resize(n); ps[0] = point({x0, y0, 0}); for(int i : range(1, n)) { int x, y; double w; scanf("%d%d%lf", &x, &y, &w); ps[i] = point({x, y, w}); } dp.resize(n, vector(1<>i & 1)) { continue; } int nmask = mask & ~(1<