#include <bits/stdc++.h>
using namespace std;
int dp[16777217];
int order[16777217];
bool taken[25];
vector<int> x, y;
int n;
vector<vector<int> > dist;
int solve(int u, int mask) {
  if (u == n + 1) return 0;
  if (mask & (1 << (u - 1))) return dp[mask] = solve(u + 1, mask);
  if (dp[mask] != -1) return dp[mask];
  int m = INT_MAX;
  for (int i = u + 1; i <= n; i++) {
    if (!(mask & (1 << (i - 1))))
      if (m > solve(u + 1, mask | (1 << (i - 1)) | (1 << (u - 1))) +
                  dist[u][i] + dist[i][0] + dist[u][0])
        m = dp[mask | (1 << (i - 1)) | (1 << (u - 1))] + dist[u][i] +
            dist[i][0] + dist[u][0],
        order[mask] = i;
  }
  if (m > solve(u + 1, mask | (1 << (u - 1))) + 2 * dist[u][0])
    m = solve(u + 1, mask | (1 << (u - 1))) + 2 * dist[u][0], order[mask] = 0;
  return dp[mask] = m;
}
void print(int u, int mask) {
  if (u == n + 1) return;
  if (mask & (1 << (u - 1))) return print(u + 1, mask);
  if (order[mask] != 0) {
    cout << 0 << " " << u << " " << order[mask] << " ";
    print(u + 1, mask | (1 << (u - 1)) | (1 << (order[mask] - 1)));
  } else
    cout << 0 << " " << u << " ", print(u + 1, mask | 1 << (u - 1));
}
int main() {
  memset(dp, -1, sizeof dp);
  ios_base::sync_with_stdio(0);
  int xx, yy;
  cin >> xx >> yy;
  x.push_back(xx);
  y.push_back(yy);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> xx >> yy, x.push_back(xx), y.push_back(yy);
  for (int i = 0; i <= n; i++) {
    vector<int> temp;
    for (int j = 0; j <= n; j++)
      temp.push_back((x[i] - x[j]) * (x[i] - x[j]) +
                     (y[i] - y[j]) * (y[i] - y[j]));
    dist.push_back(temp);
  }
  cout << solve(1, 0) << endl;
  print(1, 0);
  cout << 0;
  return 0;
}
