#include <bits/stdc++.h>
using namespace std;
int n, ans, x[30], y[30];
int b[300000];
int M[17000000], fa[17000000];
int main() {
  scanf("%d", &x[0]), scanf("%d", &y[0]);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &x[i]), scanf("%d", &y[i]);
  b[1] = 0;
  for (int b1 = 0, b2 = 1, b3 = b2, i = 0; i < n; i++, b1--)
    for (b3 = b2; b1++ < b3;)
      if ((1 << i) & b[b1])
        b[++b2] = b[b1];
      else
        for (int j = i; j <= n - 1; j++)
          if (((b[b1] | (1 << j)) > b[b1]) &&
              ((((x[0] - x[i + 1]) * (x[0] - x[i + 1]) +
                 (y[0] - y[i + 1]) * (y[0] - y[i + 1])) +
                ((x[i + 1] - x[j + 1]) * (x[i + 1] - x[j + 1]) +
                 (y[i + 1] - y[j + 1]) * (y[i + 1] - y[j + 1])) +
                ((x[j + 1] - x[0]) * (x[j + 1] - x[0]) +
                 (y[j + 1] - y[0]) * (y[j + 1] - y[0]))) <
               (((x[0] - x[i + 1]) * (x[0] - x[i + 1]) +
                 (y[0] - y[i + 1]) * (y[0] - y[i + 1])) +
                ((x[i + 1] - x[i + 1]) * (x[i + 1] - x[i + 1]) +
                 (y[i + 1] - y[i + 1]) * (y[i + 1] - y[i + 1])) +
                ((x[i + 1] - x[0]) * (x[i + 1] - x[0]) +
                 (y[i + 1] - y[0]) * (y[i + 1] - y[0]))) +
                   (((x[0] - x[j + 1]) * (x[0] - x[j + 1]) +
                     (y[0] - y[j + 1]) * (y[0] - y[j + 1])) +
                    ((x[j + 1] - x[j + 1]) * (x[j + 1] - x[j + 1]) +
                     (y[j + 1] - y[j + 1]) * (y[j + 1] - y[j + 1])) +
                    ((x[j + 1] - x[0]) * (x[j + 1] - x[0]) +
                     (y[j + 1] - y[0]) * (y[j + 1] - y[0]))))) {
            if (!M[b[b1] | (1 << i) | (1 << j)])
              b[++b2] = b[b1] | (1 << i) | (1 << j),
              M[b[b2]] =
                  M[b[b1]] + (((x[0] - x[i + 1]) * (x[0] - x[i + 1]) +
                               (y[0] - y[i + 1]) * (y[0] - y[i + 1])) +
                              ((x[i + 1] - x[j + 1]) * (x[i + 1] - x[j + 1]) +
                               (y[i + 1] - y[j + 1]) * (y[i + 1] - y[j + 1])) +
                              ((x[j + 1] - x[0]) * (x[j + 1] - x[0]) +
                               (y[j + 1] - y[0]) * (y[j + 1] - y[0]))),
              fa[b[b2]] = i * n + j;
            else if (M[b[b1] | (1 << i) | (1 << j)] >
                     M[b[b1]] +
                         (((x[0] - x[i + 1]) * (x[0] - x[i + 1]) +
                           (y[0] - y[i + 1]) * (y[0] - y[i + 1])) +
                          ((x[i + 1] - x[j + 1]) * (x[i + 1] - x[j + 1]) +
                           (y[i + 1] - y[j + 1]) * (y[i + 1] - y[j + 1])) +
                          ((x[j + 1] - x[0]) * (x[j + 1] - x[0]) +
                           (y[j + 1] - y[0]) * (y[j + 1] - y[0]))))
              M[b[b1] | (1 << i) | (1 << j)] =
                  M[b[b1]] + (((x[0] - x[i + 1]) * (x[0] - x[i + 1]) +
                               (y[0] - y[i + 1]) * (y[0] - y[i + 1])) +
                              ((x[i + 1] - x[j + 1]) * (x[i + 1] - x[j + 1]) +
                               (y[i + 1] - y[j + 1]) * (y[i + 1] - y[j + 1])) +
                              ((x[j + 1] - x[0]) * (x[j + 1] - x[0]) +
                               (y[j + 1] - y[0]) * (y[j + 1] - y[0]))),
                                         fa[b[b1] | (1 << i) | (1 << j)] =
                                             i * n + j;
          }
  int ans = (1 << n) - 1;
  printf("%d\n", M[ans]);
  for (; ans; ans -= (1 << fa[ans] / n) | (1 << fa[ans] % n))
    if (fa[ans] / n == fa[ans] % n)
      printf("0 %d ", fa[ans] / n + 1);
    else
      printf("0 %d %d ", fa[ans] / n + 1, fa[ans] % n + 1);
  printf("%d\n", 0);
  return 0;
}
