#include
#include
#include
using namespace std;
const int maxn = 1e5 + 10;
const double INF = 2e9;
vector > graph[maxn];
int n, m;
struct node {
int idx;
double cost;
node () {}
node(int _idx, double _cost) {
idx = _idx;
cost = _cost;
}
bool operator < (const node & tmp) const {
return cost > tmp.cost;
}
};
void dijkstra(int S, int E) {
vector dist(n, INF);
vector visited(n, false);
dist[S] = 0;
priority_queue pq;
pq.push(node(S, 0));
while(!pq.empty()) {
node c = pq.top();
pq.pop();
if(visited[c.idx]) continue;
visited[c.idx] = true;
for(pair tmp : graph[c.idx]) {
int neighbour = tmp.first;
double weight = tmp.second;
if(!visited[neighbour] and c.cost + weight < dist[neighbour]) {
pq.push(node(neighbour, c.cost + weight));
dist[neighbour] = c.cost + weight;
}
}
}
printf("%.6lf\n", dist[E]);
}
int main() {
int t;
cin >> t;
vector > v;
for(int i = 0; i < t; i++) {
double x, y;
cin >> x >> y;
v.push_back(make_pair(x, y));
}
for(int i = 0; i < t; i++) {
for(int j = 0; j < t; j++) {
double d = sqrt((v[i].first - v[j].first) * (v[i].first - v[j].first) + (v[i].second - v[j].second) * (v[i].second - v[j].second));
if(d <= 10) {
graph[i].push_back(make_pair(j, d));
graph[j].push_back(make_pair(i, d));
}
}
}
n = t;
dijkstra(0, n - 1);
return 0;
}
/*
5 5
1 2 2
2 3 4
1 3 2
3 4 5
4 5 6
**/