#include <bits/stdc++.h>
using namespace std;
int dist(pair<int, int> a, pair<int, int> b) {
  return pow(a.first - b.first, 2) + pow(a.second - b.second, 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  pair<int, int> bag;
  int n;
  cin >> bag.first >> bag.second >> n;
  pair<int, int> obj[n];
  for (int i = 0; i < n; i++) cin >> obj[i].first >> obj[i].second;
  int dp[1 << n], prev[1 << n];
  for (int i = 0; i < (1 << n); i++) dp[i] = 2e9;
  dp[0] = 0;
  prev[0] = 0;
  for (int i = 0; i < (1 << n); i++) {
    int k = -1;
    for (int j = 0; j < n; j++)
      if (~i & (1 << j)) {
        if (k == -1) k = j;
        int t = dp[i] + dist(obj[k], bag) + dist(obj[j], bag) +
                dist(obj[j], obj[k]);
        if (dp[i | (1 << k) | (1 << j)] > t) {
          dp[i | (1 << k) | (1 << j)] = t;
          prev[i | (1 << k) | (1 << j)] = i;
        }
      }
  }
  cout << dp[(1 << n) - 1] << '\n';
  stack<int> ans;
  for (int i = (1 << n) - 1; i > 0; i = prev[i]) ans.push(i);
  cout << "0 ";
  while (!ans.empty()) {
    for (int i = 0; i < n; i++)
      if ((1 << i) & ~prev[ans.top()] & ans.top()) cout << i + 1 << ' ';
    cout << "0 ";
    ans.pop();
  }
  cout << '\n';
}
