import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; public class Main { Scanner sc = new Scanner(System.in); double INF = Double.POSITIVE_INFINITY; int n; double[][] dist; double[][][] dp; void run() { n = sc.nextInt(); int k = sc.nextInt(); double r = sc.nextDouble(); int[] from = new int[3], to = new int[3]; fill(from, n); fill(to, n); for (int i = 0; i < k; i++) from[i] = sc.nextInt() - 1; for (int i = 0; i < k; i++) to[i] = sc.nextInt() - 1; P[] ps = new P[n]; for (int i = 0; i < n; i++) ps[i] = new P(i, sc.nextInt(), sc.nextInt()); sort(ps); for (int i = 0; i < k; i++) { int s = -1, t = -1; for (int j = 0; j < n; j++) { if (from[i] == ps[j].id) s = j; if (to[i] == ps[j].id) t = j; } from[i] = s; to[i] = t; } dist = new double[n][n]; for (int i = 0; i < n; i++) { fill(dist[i], -1); for (int j = 0; j < n; j++) if (i != j && ps[i].y <= ps[j].y) { double d = sqrt(sq(ps[i].x - ps[j].x) + sq(ps[i].y - ps[j].y)); boolean ok = false; if (d <= r + 1e-10) { ok = true; for (int a = 0; a < n; a++) if ((a - i) * (a - j) < 0) { if ((ps[i].x - ps[a].x) * (ps[j].y - ps[a].y) == (ps[i].y - ps[a].y) * (ps[j].x - ps[a].x)) { ok = false; } } } if (ok) dist[i][j] = d; } } dp = new double[n + 1][n + 1][n + 1]; for (int i = 0; i < dp.length; i++) for (int j = 0; j < dp[i].length; j++) fill(dp[i][j], INF); dp[from[0]][from[1]][from[2]] = 0; for (int s = 0; s < n; ) { int t = s; while (t < n && ps[t].y == ps[s].y) t++; // right for (int i = s; i + 1 < t; i++) move(s, i, i + 1); // left for (int i = t - 1; i - 1 >= s; i--) move(s, i, i - 1); // up for (int i = s; i < t; i++) { for (int j = t; j < n; j++) move(s, i, j); } // goal for (int p1 = s; p1 <= n; p1++) { for (int p2 = s; p2 <= n; p2++) { if (s <= to[0] && to[0] < t && dp[n][p1][p2] > dp[to[0]][p1][p2]) dp[n][p1][p2] = dp[to[0]][p1][p2]; if (s <= to[1] && to[1] < t && dp[p1][n][p2] > dp[p1][to[1]][p2]) dp[p1][n][p2] = dp[p1][to[1]][p2]; if (s <= to[2] && to[2] < t && dp[p1][p2][n] > dp[p1][p2][to[2]]) dp[p1][p2][n] = dp[p1][p2][to[2]]; } } s = t; } double res = dp[n][n][n]; if (res == INF) System.out.println(-1); else System.out.printf("%.8f%n", res); } void move(int o, int s, int t) { double d = dist[s][t]; if (d < 0) return; for (int p1 = o; p1 <= n; p1++) if (p1 != t) { for (int p2 = o; p2 <= n; p2++) if (p2 != t) { if (dp[p1][p2][t] > dp[p1][p2][s] + d) dp[p1][p2][t] = dp[p1][p2][s] + d; if (dp[p1][t][p2] > dp[p1][s][p2] + d) dp[p1][t][p2] = dp[p1][s][p2] + d; if (dp[t][p1][p2] > dp[s][p1][p2] + d) dp[t][p1][p2] = dp[s][p1][p2] + d; } } } int sq(int x) { return x * x; } class P implements Comparable

{ int id; int x, y; P(int id, int x, int y) { this.id = id; this.x = x; this.y = y; } @Override public int compareTo(P o) { if (y != o.y) return y - o.y; return x - o.x; } } public static void main(String[] args) { new Main().run(); } }