# Arup Guha
# 12/11/2024
# Solution to UCF HS Online Div 1 Problem: GAMDAR

# This solves the problem in one dimension.
def getsum(vals):

    res = 0
    
    # Go to each consecutive pair.
    for i in range(len(vals)-1):

        # gap between these two points.
        gap = vals[i+1]-vals[i]

        # This is the number of intervals this gap is in.
        # i+1 choices for a left end, len(vals)-i-1 choices for right end.
        numtimes = (i+1)*(len(vals)-i-1)

        # Add it.
        res += (gap*numtimes)

    return res

# Get number of points.
n = int(input())

# Store in parallel because we can solve each coordinate independently.
x = []
y = []
z = []

# Three parallel lists.
for i in range(n):
    toks = input().split()
    x.append(int(toks[0]))
    y.append(int(toks[1]))
    z.append(int(toks[2]))

# Helps if sorted.
x.sort()
y.sort()
z.sort()

# Total sum of Manhattan Distances over all pairs.
# Note, my method counts each pair once, but they want them counted twice...
tot = 2*(getsum(x) + getsum(y) + getsum(z))

# Take sum and divide by number of pairs.
print("%.12f" % ( tot / (n*n) ) )
