#include <bits/stdc++.h>
using namespace std;
int d(pair<int, int> q, pair<int, int> p) {
  return (q.first - p.first) * (q.first - p.first) +
         (q.second - p.second) * (q.second - p.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  pair<int, int> ori;
  int n;
  cin >> ori.first >> ori.second >> n;
  vector<pair<int, int> > point(n);
  for (int i = 0; i < n; ++i) {
    cin >> point[i].first >> point[i].second;
  }
  vector<int> dp((1 << n) + 4, INT_MAX);
  vector<int> father((1 << n) + 4, 0);
  dp[0] = 0;
  for (int i = 1; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        if (dp[i] > dp[i ^ (1 << j)] + 2 * d(ori, point[j])) {
          dp[i] = dp[i ^ (1 << j)] + 2 * d(ori, point[j]);
          father[i] = i ^ (1 << j);
        }
        for (int k = j + 1; k < n; ++k) {
          if (i & (1 << k)) {
            if (dp[i] > dp[i ^ (1 << j) ^ (1 << k)] + d(ori, point[k]) +
                            d(ori, point[j]) + d(point[j], point[k])) {
              dp[i] = dp[i ^ (1 << j) ^ (1 << k)] + d(ori, point[k]) +
                      d(ori, point[j]) + d(point[j], point[k]);
              father[i] = i ^ (1 << j) ^ (1 << k);
            }
          }
        }
        break;
      }
    }
  }
  cout << dp[(1 << n) - 1] << endl;
  int cur = (1 << n) - 1;
  cout << 0 << ' ';
  while (cur) {
    for (int i = 0; i < n; ++i) {
      if ((cur ^ father[cur]) & (1 << i)) {
        cout << i + 1 << ' ';
      }
    }
    cout << 0 << ' ';
    cur = father[cur];
  }
  return 0;
}
