#include <bits/stdc++.h>
int x[25], y[25], d[25][25], dp[1 << 24];
char pa[1 << 24], pb[1 << 24];
inline void relax(int c, int i, int j, int d) {
  int pc = c & ~(1 << i) & ~(1 << j);
  if (dp[pc] + d < dp[c]) {
    dp[c] = dp[pc] + d;
    pa[c] = i;
    pb[c] = j;
  }
}
int main(void) {
  int a, b;
  scanf("%d%d", &a, &b);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x[i], &y[i]);
    x[i] -= a;
    y[i] -= b;
  }
  for (int c = 1; c < (1 << n); c++) {
    int i = 0;
    dp[c] = 1000000000;
    while (!(((c) >> (i)) & 1)) i++;
    relax(c, i, 30, 2 * (x[i] * x[i] + y[i] * y[i]));
    for (int j = i + 1; j < n; j++) {
      if ((((c) >> (j)) & 1)) {
        relax(c, i, j,
              2 * (x[i] * x[i] + y[i] * y[i] + x[j] * x[j] + y[j] * y[j] -
                   x[i] * x[j] - y[i] * y[j]));
      }
    }
  }
  int c = (1 << n) - 1;
  printf("%d\n0", dp[c]);
  while (c) {
    if (pb[c] != 30) printf(" %d", pb[c] + 1);
    printf(" %d 0", pa[c] + 1);
    c &= ~(1 << pb[c]) & ~(1 << pa[c]);
  }
  puts("");
  return 0;
}
