#include<cstdio> #include<cmath> #include<cstring> #include<cstring> #include<iostream> #include<queue> using namespace std; const int N=205; const double INF=0x3f3f3f3f; int k,l; struct node { double x,y; int num; } s[N]; bool st[N]; double dist[N]; void spfa(int x) { memset(st,false,sizeof st ); for(int i=0;i<N;i++) dist[i]=INF; st[x]=true; dist[x]=0; queue<int>q; while(!q.empty()) q.pop(); q.push(x); while(!q.empty()) { int u=q.front(); st[u]=false; q.pop(); for(int i=1; i<=k; i++) { if(i==u) continue; double far,t; far=sqrt(((s[u].y-s[i].y)*(s[u].y-s[i].y))+((s[u].x-s[i].x)*(s[u].x-s[i].x))); far=far/1000.0; if(fabs(s[u].num-s[i].num)==1) t=far/40.0; else t=far/10.0; if(dist[i]>dist[u]+t) { dist[i]=dist[u]+t; if(!st[i]) { st[i]=true; q.push(i); } } } } } int main() { double s1,s2,e1,e2; double x,y; k=2,l=1; cin>>s1>>s2>>e1>>e2; //只有相邻的站点能到 while(cin>>x>>y) { if(x==-1&&y==-1) { if(l==8) break; l++; continue; } s[k].x=x,s[k].y=y; s[k++].num=l++; } s[1].x=s1,s[1].y=s2,s[1].num=-1; s[k].x=e1,s[k].y=e2,s[k].num=-3; spfa(1); //四舍五入 cout<<(int)(dist[k]*60+0.5)<<endl; return 0; }