#include <bits/stdc++.h>
int f[1 << 24], a[25][25], r[1 << 24], n, x[25], y[25];
int main() {
  scanf("%d%d%d", x, y, &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 + 1; i++)
    for (int j = 0; j < n + 1; j++)
      a[i][j] =
          ((x[i] - x[j]) * (x[i] - x[j])) + ((y[i] - y[j]) * (y[i] - y[j]));
  for (int i = 0; i < 1 << n; i++) f[i] = i ? 0x3f3f3f3f : 0;
  for (int i = 0; i < 1 << n; i++)
    if (f[i] < 0x3f3f3f3f)
      for (int j = 0; j < n; j++)
        if (!(i >> j & 1)) {
          for (int k = j; k < n; k++)
            if (!(i >> k & 1)) {
              int p = i | 1 << j | 1 << k,
                  q = f[i] + a[n][j] + a[k][j] + a[k][n];
              if (f[p] > q) f[p] = q, r[p] = i;
            }
          break;
        }
  printf("%d\n0", f[(1 << n) - 1]);
  for (int i = (1 << n) - 1; i; i = r[i]) {
    for (int t = i ^ r[i]; t; t -= t & -t)
      printf(" %d", int(log(t & -t) / log(2) + 1e-8 + 1));
    printf(" 0");
  }
}
