#include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector x(n), y(n), c(n), k(n); for (int i = 0; i < n; ++i) cin >> x[i] >> y[i]; for (auto &v : c) cin >> v; for (auto &v : k) cin >> v; vector best = c; vector parent(n, -1); vector used(n, false); vector stations; vector> wires; long long total = 0; for (int step = 0; step < n; ++step) { int v = -1; for (int i = 0; i < n; ++i) if (!used[i] && (v == -1 || best[i] < best[v])) v = i; used[v] = true; total += best[v]; if (parent[v] == -1) stations.push_back(v); else wires.push_back({v, parent[v]}); for (int to = 0; to < n; ++to) if (!used[to]) { long long cost = (k[v] + k[to]) * (abs(x[v] - x[to]) + abs(y[v] - y[to])); if (cost < best[to]) best[to] = cost, parent[to] = v; } } cout << total << '\n' << stations.size() << '\n'; for (int v : stations) cout << v + 1 << ' '; cout << '\n' << wires.size() << '\n'; for (auto [u, v] : wires) cout << u + 1 << ' ' << v + 1 << '\n'; }