#include <bits/stdc++.h>
using namespace std;
int X, Y, x[30], y[30];
int dist[30][30];
int lowbit[(1 << 24)], dp[(1 << 24)], path[(1 << 24)];
int norm(int x, int y) { return x * x + y * y; }
int main(void) {
  int N, mask, i, j;
  cin >> X >> Y >> N;
  for ((i) = 0; (i) < (int)(N); (i)++) cin >> x[i] >> y[i];
  for ((i) = 0; (i) < (int)(N); (i)++) {
    x[i] -= X;
    y[i] -= Y;
  }
  for ((i) = 0; (i) < (int)(N); (i)++)
    for ((j) = 0; (j) < (int)(N); (j)++)
      dist[i][j] =
          norm(x[i], y[i]) + norm(x[j], y[j]) + norm(x[i] - x[j], y[i] - y[j]);
  for ((i) = 0; (i) < (int)(N); (i)++)
    for ((j) = 0; (j) < (int)((1 << i)); (j)++) lowbit[(1 << i) + j] = i;
  for ((mask) = 0; (mask) < (int)((1 << N)); (mask)++)
    if (mask > 0) {
      int a = lowbit[mask];
      dp[mask] = dp[mask ^ (1 << a)] + dist[a][a];
      path[mask] = a;
      for ((i) = 0; (i) < (int)(N); (i)++)
        if (mask & (1 << i))
          if (i != a) {
            int tmp = dp[mask ^ (1 << a) ^ (1 << i)] + dist[a][i];
            if (tmp < dp[mask]) {
              dp[mask] = tmp;
              path[mask] = i;
            }
          }
    }
  int cur = (1 << N) - 1;
  cout << dp[cur] << endl;
  printf("0");
  while (cur > 0) {
    int a = lowbit[cur], b = path[cur];
    if (a == b) {
      printf(" %d 0", a + 1);
      cur = (cur ^ (1 << a));
    } else {
      printf(" %d %d 0", a + 1, b + 1);
      cur = (cur ^ (1 << a) ^ (1 << b));
    }
  }
  printf("\n");
  return 0;
}
