#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
inline long long read() {
  char i = getchar();
  long long f = 1, sum = 0;
  while (i < '0' || i > '9') {
    if (i == '-') f = -1;
    i = getchar();
  }
  while (i >= '0' && i <= '9') {
    sum = sum * 10 + i - '0';
    i = getchar();
  }
  return sum * f;
}
const int N = 30;
int dis[N][N], dp[1 << 24], pre[1 << 24], n;
struct zk {
  int x, y;
} A[N];
int er[N];
int main() {
  memset(dp, 0x3f, sizeof dp);
  A[0].x = read();
  A[0].y = read();
  n = read();
  for (int i = 1; i <= n; ++i) {
    A[i].x = read();
    A[i].y = read();
  }
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= n; ++j) {
      dis[i][j] = dis[j][i] = ((A[i].x - A[j].x) * (A[i].x - A[j].x) +
                               (A[i].y - A[j].y) * (A[i].y - A[j].y));
    }
  dp[0] = 0, pre[0] = 0;
  er[0] = 1;
  for (int i = 1; i < N; ++i) er[i] = er[i - 1] << 1;
  for (int st = 0; st < er[n]; ++st) {
    if (dp[st] == inf) continue;
    for (int i = 1; i <= n; ++i) {
      if (st & er[i - 1]) continue;
      for (int j = 1; j <= n; ++j) {
        if (st & er[j - 1]) continue;
        int tmp = dp[st] + dis[0][i] + dis[i][j] + dis[j][0];
        if (tmp < dp[st | er[i - 1] | er[j - 1]]) {
          pre[st | er[i - 1] | er[j - 1]] = st;
          dp[st | er[i - 1] | er[j - 1]] = tmp;
        }
      }
      break;
    }
  }
  printf("%d\n", dp[er[n] - 1]);
  int now = er[n] - 1;
  while (now) {
    int tmp = now ^ pre[now];
    printf("0 ");
    for (int i = 1; i <= n; ++i) {
      if (tmp & er[i - 1]) printf("%d ", i);
    }
    now = pre[now];
  }
  putchar('0');
  return 0;
}
