#include <bits/stdc++.h>
using namespace std;
const int INF = 1e6 + 5;
int steps[1 << 24 + 1], dp[1 << 24 + 1], f[25][25], n, a[25], b[25];
void trace(int mask) {
  if (mask == 0) return;
  int imask = mask ^ steps[mask];
  trace(steps[mask]);
  for (int i = 0; i < n; i++) {
    if ((imask & (1 << i)) == (1 << i)) {
      cout << i + 1 << " ";
    }
  }
  cout << "0 ";
}
int cacl(int x, int y, int z, int t) {
  return (x - z) * (x - z) + (y - t) * (y - t);
}
int main() {
  int x, y;
  cin >> x >> y;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      f[i][j] = f[j][i] = cacl(a[i], b[i], a[j], b[j]);
    }
  }
  memset(dp, INF, sizeof dp);
  dp[0] = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    int temp = 0, res;
    for (int j = 0; j < n; j++) {
      if ((mask & (1 << j)) == 0) {
        temp = j;
        break;
      }
    }
    int imask = mask | (1 << temp);
    res = cacl(x, y, a[temp], b[temp]);
    if (dp[imask] > dp[mask] + 2 * res) {
      dp[imask] = dp[mask] + 2 * res;
      steps[imask] = mask;
    }
    for (int j = 0; j < n; j++) {
      if ((imask & (1 << j)) == 0) {
        int curmask = imask | (1 << j);
        if (dp[curmask] >
            dp[mask] + res + f[temp][j] + cacl(a[j], b[j], x, y)) {
          dp[curmask] = dp[mask] + res + f[temp][j] + cacl(a[j], b[j], x, y);
          steps[curmask] = mask;
        }
      }
    }
  }
  cout << dp[(1 << n) - 1] << endl << "0 ";
  trace((1 << n) - 1);
}
