#include <bits/stdc++.h>
using namespace std;
struct pkt {
  int x, y;
};
struct para {
  int a, b;
};
int dist(pkt a, pkt b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
int main() {
  ios_base::sync_with_stdio(0);
  pkt s;
  int n;
  cin >> s.x >> s.y >> n;
  vector<pkt> p(n);
  for (int i = 0; i < n; ++i) cin >> p[i].x >> p[i].y;
  vector<int> dp(1 << n);
  vector<para> pop(1 << n);
  dp[0] = 0;
  pop[0] = {-1, -1};
  for (int mask = 1; mask < (1 << n); ++mask) {
    int pier = 0;
    while ((mask & (1 << pier)) == 0) ++pier;
    dp[mask] = 2 * dist(s, p[pier]) + dp[mask ^ (1 << pier)];
    pop[mask] = {pier, -1};
    for (int i = pier + 1; i < n; ++i) {
      if ((mask & (1 << i)) > 0) {
        int c = dist(s, p[pier]) + dist(s, p[i]) + dist(p[pier], p[i]);
        if (c + dp[mask ^ (1 << pier) ^ (1 << i)] < dp[mask]) {
          dp[mask] = c + dp[mask ^ (1 << pier) ^ (1 << i)];
          pop[mask] = {pier, i};
        }
      }
    }
  }
  int akt = (1 << n) - 1;
  cout << dp[akt] << endl;
  vector<int> odp;
  while (akt != 0) {
    odp.push_back(0);
    odp.push_back(pop[akt].a + 1);
    if (pop[akt].b != -1) odp.push_back(pop[akt].b + 1);
    int nowa = akt;
    nowa ^= (1 << pop[akt].a);
    if (pop[akt].b != -1) nowa ^= (1 << pop[akt].b);
    akt = nowa;
  }
  odp.push_back(0);
  for (int i = odp.size() - 1; i >= 0; --i) cout << odp[i] << " ";
  return 0;
}
