#include <bits/stdc++.h>
using namespace std;
void ckmin(int& a, const int& b) { a = min(a, b); }
const int N = 24;
int n;
pair<int, int> p[N + 1];
int dp[1 << N];
int dist(int first, int second) {
  int x = p[first].first - p[second].first;
  int y = p[first].second - p[second].second;
  return x * x + y * y;
}
int f(int mask) {
  int& ret = dp[mask];
  if (mask == (1 << n) - 1) return 0;
  if (~ret) return ret;
  ret = INT_MAX;
  for (int i = 0; i < n; ++i) {
    if (mask & (1 << i)) continue;
    ckmin(ret, f(mask | (1 << i)) + 2 * dist(n, i));
    for (int j = i + 1; j < n; ++j) {
      if (mask & (1 << j)) continue;
      ckmin(ret, f(mask | (1 << i) | (1 << j)) + dist(n, i) + dist(i, j) +
                     dist(j, n));
    }
    break;
  }
  return ret;
}
void b(int mask) {
  if (mask == (1 << n) - 1) return;
  for (int i = 0; i < n; ++i) {
    if (mask & (1 << i)) continue;
    if (f(mask) == f(mask | (1 << i)) + 2 * dist(n, i)) {
      cout << 0 << " " << i + 1 << " ";
      b(mask | (1 << i));
      return;
    }
    for (int j = i + 1; j < n; ++j) {
      if (mask & (1 << j)) continue;
      if (f(mask) == f(mask | (1 << i) | (1 << j)) + dist(n, i) + dist(i, j) +
                         dist(j, n)) {
        cout << 0 << " " << i + 1 << " " << j + 1 << " ";
        b(mask | (1 << i) | (1 << j));
        return;
      }
    }
    assert(false);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i].first >> p[i].second;
  }
  p[n] = make_pair(x, y);
  memset(dp, -1, sizeof(dp));
  cout << f(0) << "\n";
  b(0);
  cout << 0 << "\n";
  return 0;
}
