#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10, maxm = (1 << 17), mod = (int)1e9 + 7,
          hash = 701, inf = (1 << 29) + 3;
const double pi = 3.14159265359, ee = 2.71828;
int d[(1 << 24)], p[(1 << 24)], dis[25][25], n, x, y;
vector<pair<int, int> > q;
void find(int v) {
  int u = v ^ p[v];
  cout << 0 << " ";
  if (v == 0) return;
  for (int i = 0; i < n; i++)
    if (u & (1 << i)) cout << i + 1 << " ";
  find(p[v]);
}
int main() {
  ios::sync_with_stdio(0);
  cin >> x >> y >> n, q.push_back(make_pair(x, y));
  for (int i = 0; i < n; i++) cin >> x >> y, q.push_back(make_pair(x, y));
  for (int i = 0; i < q.size(); i++)
    for (int j = 0; j < q.size(); j++)
      dis[i][j] = (int)pow(q[i].first - q[j].first, 2) +
                  (int)pow(q[i].second - q[j].second, 2);
  for (int i = 1; i < (1 << n); i++) d[i] = inf;
  for (int i = 1; i < (1 << n); i++) {
    x = 0;
    while (!(i & (1 << x))) x++;
    d[i] = d[i ^ (1 << x)] + 2 * dis[0][x + 1], p[i] = i ^ (1 << x);
    for (y = x + 1; y < n; y++)
      if (i & (1 << y) && d[i] > d[i ^ (1 << x) ^ (1 << y)] +
                                     dis[x + 1][y + 1] + dis[0][x + 1] +
                                     dis[0][y + 1])
        d[i] = d[i ^ (1 << x) ^ (1 << y)] + dis[x + 1][y + 1] + dis[0][x + 1] +
               dis[0][y + 1],
        p[i] = i ^ (1 << x) ^ (1 << y);
  }
  cout << d[(1 << n) - 1] << endl;
  find((1 << n) - 1);
  cout << endl;
  return 0;
}
