#include <bits/stdc++.h>
using namespace std;
inline int dist(const pair<int, int> &p, const pair<int, int> &q) {
  return (p.first - q.first) * (p.first - q.first) +
         (p.second - q.second) * (p.second - q.second);
}
inline int dist(const pair<int, int> &p) {
  return p.first * p.first + p.second * p.second;
}
int solve(int f, int n, vector<pair<int, int> > &ps, vector<int> &tbl,
          vector<pair<int, int> > &way) {
  if (f == 0) return 0;
  int &ret = tbl[f];
  if (ret >= 0) return ret;
  int li = -1;
  for (int i = 0; i < n; i++) {
    if (f & (1 << i)) {
      li = i;
      break;
    }
  }
  way[f] = make_pair(li, -1);
  ret = dist(ps[li]) * 2 + solve(f & ~(1 << li), n, ps, tbl, way);
  for (int j = li + 1; j < n; j++) {
    if (!(f & (1 << j))) continue;
    int cur = solve(f & ~(1 << li) & ~(1 << j), n, ps, tbl, way);
    cur += dist(ps[li]);
    cur += dist(ps[li], ps[j]);
    cur += dist(ps[j]);
    if (cur < ret) {
      ret = cur;
      way[f] = make_pair(li, j);
    }
  }
  return ret;
}
int main() {
  int ox, oy;
  cin >> ox >> oy;
  int n;
  cin >> n;
  vector<pair<int, int> > dat(n);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    dat[i] = make_pair(x - ox, y - oy);
  }
  vector<int> tbl(1 << n, -1);
  vector<pair<int, int> > way(1 << n);
  cout << solve((1 << n) - 1, n, dat, tbl, way) << endl;
  int f = (1 << n) - 1;
  cout << 0;
  while (f) {
    if (way[f].second >= 0) {
      cout << " " << way[f].first + 1 << " " << way[f].second + 1 << " " << 0;
      f &= ~(1 << way[f].first) & ~(1 << way[f].second);
    } else {
      cout << " " << way[f].first + 1 << " " << 0;
      f &= ~(1 << way[f].first);
    }
  }
  cout << endl;
  return 0;
}
