#include <bits/stdc++.h>
using namespace std;
const int MN = 30;
vector<int> l[MN];
int a[MN][2], mark[MN], da[MN], dk[MN][MN], que[MN * 3], ef, que2[MN * 3], ef2,
    n, sum, Min = (1 << 30), x, y, X, ed;
int dis(int x, int y, int p, int q) {
  return (x - p) * (x - p) + (y - q) * (y - q);
}
int f(int x, int y) {
  return dis(a[X][0], a[X][1], a[x][0], a[x][1]) <
         dis(a[X][0], a[X][1], a[y][0], a[y][1]);
}
void bt(int x) {
  while (mark[x] && x < n) x++;
  if (x == n) {
    if (Min > sum) {
      Min = sum;
      for (int i = 0; i < ef; i++) {
        que2[i] = que[i];
      }
      ef2 = ef;
      que2[ef2++] = 0;
    }
    return;
  } else {
    if (Min < sum + ed) {
      return;
    }
    bool t = false;
    que[ef++] = 0;
    que[ef++] = x + 1;
    mark[x] = 1;
    ed -= da[x];
    for (int I = 0; I < n; I++) {
      int i = l[x][I];
      if (mark[i] == 0) {
        t = true;
        mark[i] = 1;
        ed -= da[i];
        sum += da[x] + da[i] + dk[x][i];
        que[ef++] = i + 1;
        bt(x + 1);
        ef--;
        mark[i] = 0;
        ed += da[i];
        sum -= da[x] + da[i] + dk[x][i];
      }
    }
    sum += da[x] * 2;
    bt(x + 1);
    sum -= da[x] * 2;
    mark[x] = 0;
    ed += da[x];
    ef -= 2;
    return;
  }
}
int main() {
  cin >> x >> y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    da[i] = dis(x, y, a[i][0], a[i][1]);
    ed += da[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dk[i][j] = dis(a[i][0], a[i][1], a[j][0], a[j][1]);
    }
    for (int j = 0; j < n; j++) {
      l[i].push_back(j);
    }
    X = i;
    sort(l[i].begin(), l[i].end(), f);
  }
  bt(0);
  cout << Min << endl;
  for (int i = 0; i < ef2; i++) {
    cout << que2[i] << " ";
  }
  cout << endl;
}
