# Arup Guha
# 12/3/2023
# Solution to 2023 UCF HS Online D2 Problem: Traveling Sales Pigeon

# Get # of items.
n = int(input())
dist = []

# Go to each points, adding just distances.
for i in range(n):
    pt = [int(x) for x in input().split()]
    dist.append( (pt[0]*pt[0] + pt[1]*pt[1])**.5 )

# Sort it.
dist.sort()

# Add up each flight twice.
tot = 0
for x in dist:
    tot += (2*x)

# We just don't go back the last time (longest)
tot -= dist[-1]

# This is just so I can check with the posted data easily.
fmtTot = "{:.10f}".format(tot)
print(fmtTot)  
