#include <bits/stdc++.h>
using namespace std;
const int maxn = 24;
int dp[1 << maxn], pre[1 << maxn];
int n, d[maxn + 2][maxn + 2], x[maxn + 2], y[maxn + 2];
int dfs1(int x) {
  if (dp[x] != -1) return dp[x];
  dp[x] = 1e9;
  for (int i = 0; i < n; i++) {
    if (x & (1 << i)) {
      int nxt = dfs1(x ^ (1 << i));
      if (dp[x] > nxt + d[n][i] + d[i][n]) {
        dp[x] = nxt + d[n][i] + d[i][n];
        pre[x] = x ^ (1 << i);
      }
      for (int j = i + 1; j < n; j++) {
        if (x & (1 << j)) {
          int nxt = dfs1(x ^ (1 << i) ^ (1 << j));
          if (dp[x] > nxt + d[n][i] + d[i][j] + d[j][n]) {
            dp[x] = nxt + d[n][i] + d[i][j] + d[j][n];
            pre[x] = x ^ (1 << i) ^ (1 << j);
          }
        }
      }
      break;
    }
  }
  return dp[x];
}
void dfs2(int x) {
  if (x) {
    for (int i = 0; i < n; i++) {
      if ((x ^ pre[x]) & (1 << i)) {
        printf("%d ", i + 1);
      }
    }
    printf("0 ");
    dfs2(pre[x]);
  }
}
int main() {
  scanf("%d%d", &x[0], &y[0]);
  scanf("%d", &n);
  x[n] = x[0], y[n] = y[0];
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x[i], &y[i]);
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
    }
  }
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  int mask = (1 << n) - 1;
  int ans = dfs1(mask);
  printf("%d\n", ans);
  printf("0 ");
  dfs2(mask);
  printf("\n");
  return 0;
}
