#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int n, m;
int s, t;
double map[101][101];
struct
coordinate
{
int x;
int y;
coordinate()
{
x = y = 0;
}
}c[101];
void
__read__()
{
cin >> n;
for( int i = 1; i <= n; i++ )
for( int j = 1; j <= n; j++ )
map[i][j] = 999999;
for( int i = 1; i <= n; i++ )
cin >> c[i].x >> c[i].y;
cin >> m;
for( int i = 1; i <= m; i++ )
{
int p, q;
cin >> p >> q;
map[q][p] = map[p][q] = sqrt( ( c[p].x - c[q].x ) * ( c[p].x - c[q].x )
+ ( c[p].y - c[q].y ) * ( c[p].y - c[q].y ) );
}
cin >> s >> t;
}
void
__floyd__()
{
for( int k = 1; k <= n; k++ )
for( int i = 1; i <= n; i++ )
for( int j = 1; j <= n; j++ )
if( i != j && i != k && j != k )
if( map[i][j] > map[i][k] + map[k][j] )
map[i][j] = map[i][k] + map[k][j];
}
void
__outp__()
{
cout << setiosflags( ios::fixed ) << setprecision( 2 )
<< map[s][t] << endl;
}
int
main()
{
__read__();
__floyd__();
__outp__();
return 0;
}