#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
double f[105][105];
int n, m, x[105], y[105], a, b;
double getline(int a, int b)
{
return sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2));
}
int main()
{
memset(f, 0x7f, sizeof(f));
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> x[i] >> y[i];
}
cin >> m;
for (int i = 1; i <= m; i++)
{
cin >> a >> b;
f[a][b] = f[b][a] = getline(a, b);
}
for (int k = 1; k <= n; k++)
{
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (f[i][j] > f[i][k] + f[k][j])
{
f[i][j] = f[i][k] + f[k][j];
}
}
}
}
cin >> a >> b;
printf("%.2lf", f[a][b]);
return 0;
}