#include<bits/stdc++.h>
#define INF 1e9
using namespace std;
const int N=500;
int n,m;
double x[N],y[N];
struct zjy
{
int to;
double wide;
zjy(int tv=0,double tc=0):
to(tv),wide(tc){}
};
typedef pair<int,double> P;
double dist[N];
double dist2[N];
vector<zjy> G[N];
double verb(int p,int q)
{
return 1.00*sqrt(1.00*(x[p]-x[q])*(x[p]-x[q])+1.00*(y[p]-y[q])*(y[p]-y[q]));
}
void dfs()
{
fill(dist,dist+N,INF);
fill(dist2,dist2+N,INF);
priority_queue<P, vector<P>, greater<P> > Q;
dist[0]=0;
Q.push(P(0,0));
while(!Q.empty())
{
P u=Q.top();
Q.pop();
int v=u.first;
double d=u.second;
if(dist2[v]<d)
{
continue;
}
for(unsigned i=0;i<G[v].size();++i)
{
zjy &e=G[v][i];
double d2=d+e.wide;
if(dist[e.to]>d2)
{
swap(dist[e.to],d2);
Q.push(P(e.to,dist[e.to]));
}
if(dist2[e.to]>d2&&dist[v]<d2)
{
dist2[e.to]=d2;
Q.push(P(e.to,dist2[e.to]));
}
}
}
printf("%.2lf\n",dist2[n-1]);
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
cin>>x[i]>>y[i];
}
for(int i=1;i<=m;i++)
{
int p,q;
scanf("%d%d",&p,&q);
G[p-1].push_back(zjy(q-1,verb(p,q)));
// printf("%.2lf\n",verb(p,q));
G[q-1].push_back(zjy(p-1,verb(p,q)));
}
dfs();
return 0;
}