#include <bits/stdc++.h>
using namespace std;
int dp[1 << 25] = {0};
int pre[1 << 25];
struct node {
  int x, y;
} a[25], c;
int n;
int sqr(int x) { return x * x; }
int cal(struct node a, struct node b) {
  return sqr(a.x - b.x) + sqr(a.y - b.y);
}
void path(int x) {
  if (x == 0) return;
  path(pre[x]);
  for (int i = 0; i < n; i++) {
    if (!(pre[x] & (1 << i)) && (x & (1 << i))) printf(" %d", i + 1);
  }
  printf(" 0");
}
int main() {
  scanf("%d %d %d", &c.x, &c.y, &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &a[i].x, &a[i].y);
  for (int i = 1; i < (1 << n); i++) dp[i] = 1e9;
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if (((1 << j) & i)) continue;
      for (int k = j; k < n; k++) {
        if ((1 << k) & i) continue;
        int tmp = dp[i] + cal(a[j], a[k]) + cal(a[j], c) + cal(a[k], c);
        if (dp[i | (1 << j) | (1 << k)] > tmp) {
          pre[i | (1 << j) | (1 << k)] = i;
          dp[i | (1 << j) | (1 << k)] = tmp;
        }
      }
      break;
    }
  }
  printf("%d\n", dp[(1 << n) - 1]);
  printf("0");
  path((1 << n) - 1);
  printf("\n");
  return 0;
}
