#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
struct node {
  int x, y;
} cor[30];
int dist(int a, int b) {
  return (cor[a].x - cor[b].x) * (cor[a].x - cor[b].x) +
         (cor[a].y - cor[b].y) * (cor[a].y - cor[b].y) + cor[a].x * cor[a].x +
         cor[a].y * cor[a].y + cor[b].x * cor[b].x + cor[b].y * cor[b].y;
}
int d[1 << 24] = {0}, f[1 << 24] = {0};
int main() {
  int xs, ys, n;
  cin >> xs >> ys >> n;
  for (int i = 0; i < n; i++) {
    cin >> cor[i].x >> cor[i].y;
    cor[i].x -= xs;
    cor[i].y -= ys;
  }
  for (int s = 1; s < (1 << n); s++) d[s] = INF;
  if (n & 1) {
    for (int s = 0; s < (1 << n); s++) {
      int i, j;
      for (i = n - 1; i >= 0; i--)
        if (s & (1 << i)) break;
      for (j = i - 1; j >= 0; j--)
        if (s & (1 << j)) {
          if (d[s] > dist(i, j) + d[s ^ (1 << i) ^ (1 << j)]) {
            d[s] = dist(i, j) + d[s ^ (1 << i) ^ (1 << j)];
            f[s] = s ^ (1 << i) ^ (1 << j);
          }
        }
      if (s)
        if (d[s] > dist(i, i) + d[s ^ (1 << i)]) {
          d[s] = dist(i, i) + d[s ^ (1 << i)];
          f[s] = s ^ (1 << i);
        }
    }
  } else {
    for (int s = 0; s < (1 << n); s++) {
      int i, j, tmpj;
      for (i = n - 1; i >= 0; i--)
        if (s & (1 << i)) break;
      for (j = i - 1; j >= 0; j--)
        if (s & (1 << j)) {
          if (d[s] > dist(i, j) + d[s ^ (1 << i) ^ (1 << j)]) {
            d[s] = dist(i, j) + d[s ^ (1 << i) ^ (1 << j)];
            f[s] = s ^ (1 << i) ^ (1 << j);
          }
        }
      if (s)
        if (d[s] > dist(i, i) + d[s ^ (1 << i)]) {
          d[s] = dist(i, i) + d[s ^ (1 << i)];
          f[s] = s ^ (1 << i);
        }
    }
  }
  cout << d[(1 << n) - 1] << endl;
  int p = (1 << n) - 1;
  while (p) {
    cout << "0 ";
    int tmp = f[p];
    for (int i = 0; i < n; i++)
      if ((p & (1 << i)) && !(tmp & (1 << i))) cout << i + 1 << " ";
    p = tmp;
  }
  cout << "0" << endl;
  return 0;
}
