#include <bits/stdc++.h>
using namespace std;
int n, xs, ys;
const int maxl = (1 << 25);
short int x[30], y[30];
int d[30][30];
int dp[maxl], par[maxl];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> xs >> ys >> n;
  for (int i = 1; i <= n; i++) cin >> x[i] >> y[i];
  for (int i = 1; i <= n; i++) {
    d[i][0] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);
    for (int j = 1; j <= n; j++)
      d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
  }
  dp[0] = 0;
  fill(dp + 1, dp + maxl, std::numeric_limits<int>::max() / 2);
  for (int mask = 1; mask < (1 << n); ++mask) {
    int i = 0;
    while (!(mask & (1 << i))) ++i;
    int tmp = dp[mask - (1 << i)] + 2 * d[i + 1][0];
    if (dp[mask] > tmp) dp[mask] = tmp, par[mask] = mask - (1 << i);
    for (int j = i + 1; j < n; ++j)
      if (mask & (1 << j)) {
        tmp = dp[mask - (1 << i) - (1 << j)] + d[i + 1][0] + d[i + 1][j + 1] +
              d[j + 1][0];
        if (dp[mask] > tmp)
          dp[mask] = tmp, par[mask] = mask - (1 << i) - (1 << j);
      }
  }
  cout << dp[(1 << n) - 1] << endl;
  int mask = (1 << n) - 1, mask1 = -1;
  vector<short int> ans;
  while (mask != 0) {
    mask1 = par[mask];
    vector<short int> v;
    for (int i = 0; i < n; i++) {
      if ((mask & (1 << i)) && !(mask1 & (1 << i))) v.push_back(i);
    }
    for (int i = 0; i < v.size(); i++) ans.push_back(v[i] + 1);
    ans.push_back(0);
    mask = mask1;
  }
  reverse(ans.begin(), ans.end());
  ans.push_back(0);
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
