#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> arr[30];
map<long long, long long> dp, vis, nex;
map<long long, vector<long long>> ans;
long long n;
void bpr(long long t) {
  for (long long i = 1; i < n + 1; i++) {
    cout << t % 2;
    t /= 2;
  }
  cout << endl;
}
long long min(long long a, long long b) { return (a < b) ? a : b; }
long long razd(long long i, long long j) {
  return (arr[i].first - arr[j].first) * (arr[i].first - arr[j].first) +
         (arr[i].second - arr[j].second) * (arr[i].second - arr[j].second);
}
long long solve(long long id) {
  if (vis[id]) return dp[id];
  dp[id] = LLONG_MAX / 2;
  vis[id] = 1;
  long long neki[n + 1];
  long long temp = id;
  for (long long i = 1; i < n + 1; i++) neki[i] = temp % 2, temp /= 2;
  for (long long i = 1; i < n + 1; i++) {
    if (neki[i]) {
      long long tem = 2 * razd(i, 0) + solve(id - (1 << (i - 1)));
      if (dp[id] > tem)
        dp[id] = tem, ans[id].clear(), ans[id].push_back(i),
        nex[id] = id - (1 << (i - 1));
      for (long long j = 1; j < n + 1; j++) {
        if (i != j and neki[j]) {
          tem = razd(0, i) + razd(0, j) + razd(i, j) +
                solve(id - (1 << (i - 1)) - (1 << (j - 1)));
          if (dp[id] > tem)
            dp[id] = tem, ans[id].clear(), ans[id].push_back(i),
            ans[id].push_back(j),
            nex[id] = id - (1 << (i - 1)) - (1 << (j - 1));
        }
      }
      break;
    }
  }
  return dp[id];
}
int main() {
  scanf("%lld%lld", &arr[0].first, &arr[0].second);
  cin >> n;
  for (long long i = 1; i < n + 1; i++)
    scanf("%lld%lld", &arr[i].first, &arr[i].second);
  vis[0] = 1;
  cout << solve((1 << (n)) - 1) << endl;
  long long temp = (1 << (n)) - 1;
  while (temp) {
    cout << 0 << " ";
    for (auto&& v : ans[temp]) cout << v << " ";
    temp = nex[temp];
  }
  cout << 0 << " ";
}
