#include <bits/stdc++.h>
using namespace std;
int memo[(1 << 24) + 9];
int N;
int X[25], Y[25];
int Distance(int idx1, int idx2) {
  return (X[idx1] - X[idx2]) * (X[idx1] - X[idx2]) +
         (Y[idx1] - Y[idx2]) * (Y[idx1] - Y[idx2]);
}
pair<int, int> get(int msk, int o1, int o2) {
  int nmsk = msk | (1 << o1);
  int dis = Distance(0, o1 + 1);
  if (o2 != -1) {
    nmsk |= (1 << o2);
    dis += (Distance(o1 + 1, o2 + 1) + Distance(o2 + 1, 0));
  } else
    dis *= 2;
  return make_pair(nmsk, dis);
}
int DP(int msk) {
  if (__builtin_popcount(msk) == N) {
    return 0;
  }
  int &ref = memo[msk];
  if (ref != -1) return ref;
  ref = (1 << 28);
  int o1 = -1, o2 = -1;
  for (int i = 0; i < N; ++i) {
    if (!(msk & (1 << i))) {
      if (o1 == -1)
        o1 = i;
      else
        o2 = i;
      pair<int, int> P = get(msk, o1, o2);
      ref = min(ref, DP(P.first) + P.second);
    }
  }
  return ref;
}
void build(int msk) {
  if (__builtin_popcount(msk) == N) {
    return;
  }
  int ref = DP(msk);
  int o1 = -1, o2 = -1;
  for (int i = 0; i < N; ++i) {
    if (!(msk & (1 << i))) {
      if (o1 == -1)
        o1 = i;
      else
        o2 = i;
      pair<int, int> P = get(msk, o1, o2);
      if (ref == (DP(P.first) + P.second)) {
        printf(" %d", o1 + 1);
        if (o2 == -1)
          printf(" 0");
        else
          printf(" %d 0", o2 + 1);
        build(P.first);
        return;
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &X[0], &Y[0], &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d%d", &X[i], &Y[i]);
  }
  memset(memo, -1, sizeof memo);
  int mn = DP(0);
  printf("%d\n0", mn);
  build(0);
  return 0;
}
