#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e9 + 7;
int int_pow(int base, int exp) {
  int result = 1;
  while (exp) {
    if (exp & 1) result *= base;
    exp /= 2;
    base *= base;
  }
  return result;
}
vector<pair<int, int> > v;
int dp[20000000], par[20000000];
int dist(int x, int y, int x1, int y1) {
  return ((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int x, y, n;
  cin >> x >> y >> n;
  for (int i = 0; i < n; i++) {
    int u, z;
    cin >> u >> z;
    v.push_back(make_pair(u, z));
  }
  fill_n(dp, 20000000, MAXN);
  dp[0] = 0;
  for (int i = 1; i < (1 << (n)); i++) {
    int z = i, a = 0;
    while (z) {
      if (z % 2 == 1) break;
      z /= 2;
      a++;
    }
    int msk = i ^ (1 << (a));
    if (dp[i] > dp[i ^ (1 << (a))] + 2 * dist(x, y, v[a].first, v[a].second))
      par[i] = msk;
    dp[i] = min(dp[i],
                dp[i ^ (1 << (a))] + 2 * dist(x, y, v[a].first, v[a].second));
    int x1 = v[a].first, y1 = v[a].second;
    z = i, a = 0;
    while (z) {
      if (z % 2 == 1) {
        if (dp[i] > dp[msk ^ (1 << (a))] + dist(x, y, v[a].first, v[a].second) +
                        dist(x, y, x1, y1) +
                        dist(x1, y1, v[a].first, v[a].second))
          par[i] = msk ^ (1 << (a));
        dp[i] =
            min(dp[i],
                dp[msk ^ (1 << (a))] + dist(x, y, v[a].first, v[a].second) +
                    dist(x, y, x1, y1) + dist(x1, y1, v[a].first, v[a].second));
      }
      z /= 2;
      a++;
    }
  }
  cout << dp[(1 << (n)) - 1] << "\n0 ";
  int mask = (1 << (n)) - 1;
  while (mask) {
    int msk = mask ^ par[mask], a = 0;
    while (msk) {
      if (msk % 2 == 1) cout << a + 1 << ' ';
      msk /= 2;
      a++;
    }
    cout << "0 ";
    mask = par[mask];
  }
}
