#include <bits/stdc++.h>
using namespace std;
long xs, ys, x[30], y[30], dp[1 << 24], par[1 << 24];
long n, q, td;
long gd(long x1, long aasdfasdfasdf, long x2, long y2) {
  return (x1 - x2) * (x1 - x2) + (aasdfasdfasdf - y2) * (aasdfasdfasdf - y2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> xs >> ys;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  for (int i = 0; i < (1 << n); i++) dp[i] = 1e9;
  dp[0] = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    if (mask + 1 == (1 << n)) continue;
    q = 0;
    while (mask & (1 << q)) ++q;
    td = dp[mask] + gd(xs, ys, x[q], y[q]) * 2;
    if (td < dp[mask | (1 << q)]) {
      dp[mask | (1 << q)] = td;
      par[mask | (1 << q)] = mask;
    }
    for (int e = q + 1; e < n; e++)
      if ((mask & (1 << e)) == 0) {
        td = dp[mask] + gd(xs, ys, x[q], y[q]) + gd(xs, ys, x[e], y[e]) +
             gd(x[q], y[q], x[e], y[e]);
        if (td < dp[mask | (1 << q) | (1 << e)]) {
          dp[mask | (1 << q) | (1 << e)] = td;
          par[mask | (1 << q) | (1 << e)] = mask;
        }
      }
  }
  cout << dp[(1 << n) - 1] << endl;
  cout << 0;
  long mask = (1 << n) - 1;
  while (mask > 0) {
    vector<long> v;
    long tmask = par[mask];
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i))
        if ((tmask & (1 << i)) == 0) cout << " " << i + 1;
    }
    cout << " " << 0;
    mask = tmask;
  }
  cout << endl;
  cin.get();
  cin.get();
  return 0;
}
