#include <bits/stdc++.h>
using namespace std;
int dis[30][30], pre[1 << 24 + 1], dp[1 << 24 + 1], x[30], y[30], n;
int main() {
  scanf("%d%d", &x[0], &y[0]);
  scanf("%d", &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 = 0; j <= n; j++)
      dis[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
  for (int i = 1; i <= (1 << n) - 1; i++) {
    dp[i] = 2147483646;
  }
  for (int i = 0; i <= (1 << n) - 1; i++) {
    if (dp[i] == 2147483646) continue;
    for (int j = 1; j <= n; j++) {
      if (i & 1 << (j - 1)) continue;
      for (int k = 1; k <= n; k++) {
        if (i & 1 << (k - 1)) continue;
        if (dp[i | (1 << (j - 1)) | (1 << (k - 1))] >
            dp[i] + dis[0][j] + dis[k][j] + dis[k][0]) {
          dp[i | (1 << (j - 1)) | (1 << (k - 1))] =
              dp[i] + dis[0][j] + dis[k][j] + dis[k][0];
          pre[i | (1 << (j - 1)) | (1 << (k - 1))] = i;
        }
      }
      break;
    }
  }
  printf("%d\n", dp[(1 << n) - 1]);
  int now = (1 << n) - 1;
  while (now > 0) {
    printf("0 ");
    for (int i = 1; i <= n; i++)
      if (1 << i - 1 & (now ^ pre[now])) printf("%d ", i);
    now = pre[now];
  }
  printf("0 ");
}
