#include <stdio.h>
#include <math.h>
#define rep(i,l,r)for(int i=(l);i<(r);i++)
#define min(p,q)((p)<(q)?(p):(q))

double dp[1010][1010];
//dp[i][j]=現在地がiで最後に飛ばしたのがjで確定した距離
int x[1010],y[1010];

int main(){
	int n;
	scanf("%d",&n);
	rep(i,0,n)scanf("%d%d",x+i,y+i);
	dp[1][0]=hypot(x[1]-x[0],y[1]-y[0]);
	rep(i,2,n+1){
		rep(j,0,i-1)dp[i][j]=dp[i-1][j]+hypot(x[i]-x[i-1],y[i]-y[i-1]);
		dp[i][i-1]=1e10;
		rep(j,0,i-1)dp[i][i-1]=min(dp[i][i-1],dp[i-1][j]+hypot(x[i]-x[j],y[i]-y[j]));
	}
	double ans=1e10;
	rep(j,0,n-1)ans=min(ans,dp[n-1][j]+hypot(x[n-1]-x[j],y[n-1]-y[j]));
	printf("%.9f\n",ans);
}
