#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5, M = (1 << 24) + 5;
int x[N], y[N], dis[N][N], f[M], n, pre[M];
int main() {
  scanf("%d%d%d", &x[0], &y[0], &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
  for (int i = 0; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      dis[i][j] = dis[j][i] =
          (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 1; i <= n; i++) {
      if (mask & (1 << (i - 1))) continue;
      for (int j = 1; j <= n; j++) {
        if (mask & (1 << (j - 1))) continue;
        int nxt = mask | (1 << (i - 1)) | (1 << (j - 1));
        if (f[nxt] <= f[mask] + dis[0][i] + dis[i][j] + dis[j][0]) continue;
        f[nxt] = f[mask] + dis[0][i] + dis[i][j] + dis[j][0];
        pre[nxt] = mask;
      }
      break;
    }
  }
  int now = (1 << n) - 1;
  printf("%d\n", f[now]);
  while (now) {
    printf("0 ");
    for (int i = 1; i <= n; i++)
      if ((now ^ pre[now]) & (1 << (i - 1))) printf("%d ", i);
    now = pre[now];
  }
  puts("0");
  return 0;
}
