#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma G++ optimize("O3")
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int maxn = 2e4 + 7;
const int maxm = 25;
const int mod = 1e9 + 7;
pair<int, int> s[maxm];
int dp[1 << maxm];
int pre[1 << maxm];
int len(int i, int j) {
  return (s[i].first - s[j].first) * (s[i].first - s[j].first) +
         (s[i].second - s[j].second) * (s[i].second - s[j].second);
}
int main() {
  int x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  s[n].first = x, s[n].second = y;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    s[i].first = x, s[i].second = y;
  }
  memset((dp), (INF), sizeof(dp));
  dp[0] = 0;
  for (int i = 0; i < (1 << n); ++i) {
    if (dp[i] == INF) continue;
    for (int j = 0; j < n; ++j) {
      if (((1 << j) & i) == 0) {
        for (int k = j; k < n; ++k) {
          if (((1 << k) & i) == 0) {
            int cnt = i | (1 << j) | (1 << k);
            int dis = len(j, k) + len(j, n) + len(k, n);
            if (dp[cnt] > dp[i] + dis) {
              dp[cnt] = dp[i] + dis;
              pre[cnt] = i;
            }
          }
        }
        break;
      }
    }
  }
  cout << dp[(1 << n) - 1] << '\n';
  cout << 0;
  for (int i = (1 << n) - 1; i; i = pre[i]) {
    for (int j = 0; j < n; ++j)
      if ((i ^ pre[i]) & (1 << j)) cout << " " << j + 1;
    cout << " " << 0;
  }
  cout << '\n';
  return 0;
}
