jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep1(i,n) for (ll i = 1; i <= (n); ++i)
#define rrep(i,n) for (ll i = (n)-1; i >=0; --i)
#define ALL(a) a.begin(),a.end()
#define pb push_back
#define dame { puts("-1"); return 0;}
#define show(x) cerr<<#x<<" = "<<x<<endl;

using namespace std;
using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;

typedef vector<ll> vl;
typedef vector<pl> vp;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }


// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);

ll LINF = 1000000000000000000;

int main() {
  ll n;
  cin >> n;

  ll ans = 1;
  vector<ll> a(n);
  rep(i, n){
    cin >> a[i];
    if(a[i]==0){
      cout << 0 << endl;
      return 0;
    }

  }
  rep(i, n){
    ll tmp = a[i];
    show(tmp);
    show(ans);
    show(1e18/ans)
      if(ans>LINF/tmp ||((LINF)%tmp>0 && ans==LINF/tmp)){
      cout << -1 << endl;
      return 0;
    }
    ans *= tmp;
    if(ans>LINF){
      cout << -1 << endl;
      return 0;
    }

  }

  cout << ans << endl;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	const llong inf=1e18;
	
	int n;
	cin>>n;
	
	vector<llong> aa(n);
	REP(i,n) cin>>aa[i];
	sort(ALL(aa));
	
	llong ans=1;
	REP(i,n){
		llong a=aa[i];
		debug(a);
		
		double tmp=log10(ans)+log10(a);
		debug(tmp);
		if(tmp>18){
			cout<<-1<<endl;
			return 0;
		}
		
		ans*=a;
		debug(ans);
		if(ans>inf){
			cout<<-1<<endl;
			return 0;
		}
	}
	
	cout<<ans<<endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);
 
 
int main(void)
{
  int n;
  cin>>n;
  ll ans = 1;
  bool ng = 0;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    if(a == 0){
    	cout << 0 << endl;
    	return 0;
    }
    // (a*ans > INF) -> NG
    // INF/a == (INF - INF%a) / a
    if(INF%a == 0 && ans > INF/a){
    	ng = 1;
    }
    else if(INF % a && ans > (INF/a)) {
    	ng = 1;
    }
    cerr << ans << " " << INF%a << " " << (INF/a)<<" "<<(INF/a)*ans << " " << endl;
    ans *= a;
  }
  if(ng)ans=-1;
  cout << ans << endl;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void)
{
    int N;
    long long int *A;
    long long int ans = 1;
    double dA;
    double dans;
    char temp[30];
    char temp2[30];
    int c;
    scanf("%d", &N);
    A = (long long int *)malloc(sizeof(long long int) * N);
    for (c = 0; c < N; ++c)
    {
        scanf("%lld", A + c);
        if (A[c] == 0)
        {
            printf("0");
            return 0;
        }
    }
    for (c = 0; c < N; ++c)
    {
        sprintf(temp, "%lld", A[c]);
        sprintf(temp2, "%lld", ans);
        sscanf(temp, "%lf", &dA);
        sscanf(temp2, "%lf", &dans);
        if (log10(dA * dans) > 19)
        {
            printf("-1");
            return 0;
        }
        ans *= A[c];
        if (ans > (long long)1e+18)
        {
            printf("-1");
            return 0;
        }
    }
    printf("%lld", ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <inttypes.h>

#define INF UINT64_C(1111111111111111111)
#define LIMIT UINT64_C(1000000000000000000)

uint64_t add(uint64_t a, uint64_t b) {
	uint64_t x = a + b;
	return x > INF ? INF : x;
}

uint64_t mul(uint64_t a, uint64_t b) {
	uint64_t r = 0;
	while (b > 0) {
		if (b & 1) r = add(r, a);
		a = add(a, a);
		b >>= 1;
	}
	return r;
}

int main(void) {
	int N, i;
	uint64_t answer = 1;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		uint64_t A;
		if (scanf("%" SCNu64, &A) != 1) return 1;
		answer = mul(answer, A);
	}
	if (answer > LIMIT) puts("-1"); else printf("%" PRIu64 "\n", answer);
	return 0;
}
//  [c]
#include <stdio.h>

int main()
{
	int i, N, flag = 0;
	long long A, ans = 1;
	long double X = 1.0;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%lld", &A);
		if (A == 0) {
			flag = 0;
			ans = 0;
			break;
		}
		ans *= A;
		X *= A;
		if (X > 1e+18) flag = 1;
	}
	if (flag == 0) printf("%lld\n", ans);
	else printf("-1\n");
	fflush(stdout);
	return 0;
}
//  [javascript]
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

console.log(main());

function main() {
    var n = +cin.shift();
    if (cin.indexOf('0') >= 0) return 0;
    let ans = 1n;
    let max = BigInt(10) ** BigInt(18);
    for (let i = 0; i < n; i++) {
        ans = ans * BigInt(cin.shift());
        if (ans > max) return -1;
    }
    return ans.toString();
}
//  [javascript]
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var A = input[1].split(" ").map(i => BigInt(i));
  A.sort();
  var ans = 1n;
  for(var i=0;i<N;i++){
    ans = ans * A[i];
    if(ans > 1000000000000000000n){
      ans = -1;
      break;
    }else if(ans === 0n){
      break;
    }
  }
  ans = ans.toString();

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {

	var N int
	fmt.Scanf("%d", &N)

	A := make([]int64, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &A[i])
	}

	sort.Slice(A, func(i, j int) bool {
		return A[i] < A[j]
	})

	var Result int64
	Result = 1

	flag := 0
	if A[0] == 0 {
		fmt.Println("0")
		flag = 1
	} else {
		for i := 0; i < N; i++ {
			if A[i] <= 1000000000000000000/Result {
				Result = Result * A[i]
			} else {
				fmt.Println("-1")
				flag = 1
				break
			}
		}
	}

	if flag == 0 {
		fmt.Println(Result)
	}
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	var a []int64
	for i := 0; i < n; i++ {
		var s int64
		fmt.Scan(&s)
		a = append(a, s)
	}
	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
	if a[0] == 0 {
		fmt.Println(0)
		return
	}
	ans := int64(1)
	for _, v := range a {
		if v > int64(1e18) / ans {
			fmt.Println("-1")
			return
		}
		ans *= v
	}
	fmt.Print(ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var (
		n int
	)

	fmt.Scan(&n)
	max := 1000000000000000000
	a := make([]int, n)
	sum := 1
	for i := range a {
		fmt.Scan(&a[i])
		if a[i] == 0 {
			fmt.Print(0)
			return
		}
	}
	for _, j := range a {
		if j <= max/sum {
			sum *= j
		} else {
			fmt.Print(-1)
			return
		}
	}
	fmt.Print(sum)
}
//  [ruby]
def main
    n = gets.to_i
    as = gets.chomp.split(" ").map(&:to_i)
    ans = 1

    while as.size > 1
        as.push 1 if as.size % 2 == 1
        bs = []
        (0..as.size/2-1).each do |i|
            bs.push (as[2*i] * as[2*i+1])
        end
        as = Marshal.load(Marshal.dump(bs))
    end
    if as[0] > 10**18
        puts -1
        return
    else
        puts as[0]
    end
end

main
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
N, a_list = gets_n_and_i_list

a_list.sort!

def xxx(arr)
  loop do
    return arr[0] if arr.length == 1
    arr = arr.each_slice(2).map { |a, b| b ? a * b : a }
  end
end

total = xxx(a_list)

if total > 10**18
  puts -1
else
  puts total
end
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
N, a_list = gets_n_and_i_list

a_list.sort!
total = 0
loop do
  if a_list.length == 1
    total = a_list[0]
    break
  end
  a_list = a_list.each_slice(2).map { |a, b| b ? a * b : a }
end

puts total > 10**18 ? -1 : total
//  [rust]
use proconio::*;
use num::bigint::*;

fn calc(a: &[u64]) -> BigUint {
    if a.len() == 1 {
        BigUint::from(a[0])
    } else {
        let m = a.len() / 2;
        let (a, b) = a.split_at(m);
        let l = calc(a);
        let r = calc(b);
        l * r
    }
}

fn run() {
    input! {
        n: usize,
        a: [u64; n],
    }
    let ans = calc(&a);
    if ans > BigUint::from(10u64.pow(18)) {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}

fn main() {
    run();
}
//  [rust]
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut xs: Vec<i128> = sc.vec(n);
    xs.sort();
    let mut a: i128 = 1;
    for &x in xs.iter() {
        a *= x;
        if a > 1_000_000_000_000_000_000 {
            put!(-1);
            return;
        }
    }
    put!(a);
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}
//  [swift]
import Foundation

_ = readLine()
let ints = readLine()!.split(separator: " ").map { Decimal(string: String($0))! }
var r: Decimal = 1
if ints.contains(0) { r = 0 }
for i in ints {
    r *= i
    if r > 1_000_000_000_000_000_000 {
        r = -1
        break
    }
}
print(r)
//  [swift]
let N = Int(readLine()!)!

func solveB(array: [Int]) -> Int? {
    guard array.first(where: { $0 == 0 }) == nil else { return 0 }
    var result = 1
    for a in array {
        let (partialValue, overflow) = result.multipliedReportingOverflow(by: a)
        if overflow || partialValue > 1_000_000_000_000_000_000 {
            return nil
        } else {
            result = partialValue
        }
    }

    return result
}

print(solveB(array: readLine()!.split(separator: " ").map { Int($0)! }) ?? "-1")
//  [swift]
import Foundation

let N = Int(readLine()!)!
let A = readLine()!.components(separatedBy: " ").map { Decimal(Int($0)!) }
var M = Decimal(1)

guard A.filter({ $0 == 0 }).count == 0 else {
    print(0)
    exit(EXIT_SUCCESS)
}

for i in 0..<N {
    M *= A[i]
    guard M <= pow(Decimal(10), 18) else {
        print(-1)
        exit(EXIT_SUCCESS)
    }
}
print(M)
//  [typescript]
import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'
 
let lines: string[] = [];
const reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
 
reader.on('line', function (line: string) {
    lines.push(line);
});
reader.on('close', function () {
    let n = parseInt(lines[0])
    let a = lines[1].split(' ').map( _ => parseInt(_))
    let ans = BigInt(1)

    for(let i = 0; i < n; i++) {
        if(a[i] == 0) {
            console.log(0)
            return
        }
    }

    for(let i = 0; i < n; i++) {
        ans = ans * BigInt(a[i])
        if(ans > 10**18) {
            console.log(-1)
            return
        }
    }

    console.log(String(ans))

});
//  [typescript]
/**
 * https://atcoder.jp/contests/abc169/tasks/abc169_b
 * N 個の整数 A1,...,AN が与えられます。
 * A1×...×AN を求めてください。
 * ただし、結果が 10^18 を超える場合は、代わりに -1 を出力してください。
 */
export function Main(input: string) {
  // 問題文解体エリア
  const inputs = input.split("\n");
  const nums = inputs[1].split(" ").map(s => BigInt(new Number(s).valueOf()));

  // 問題解決エリア
  const answer = fuck(nums);

  //出力エリア
  console.log(answer.toString());
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
// 提出する時にコメントアウト解除せよ
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

export function fuck(nums: Array<BigInt>): BigInt {
  // numberで計算するとバグる
  // 1000000000000000001であるべきだが、1000000000000000000になる
  // 例としてrubyだと正しく計算
  // console.log(Number.MAX_SAFE_INTEGER);
  // console.log(101 * 9901 * 999999000001);

  // 最初に0が含まれるかチェックする。そうすれば10^18を超えてるかどうかの検証をfor文内でできるため、タイムアウトなくなる？
  const containsZero: boolean = nums.find(n => n == BigInt(0)) != null;
  if (containsZero) return BigInt(0);

  let result = BigInt(1);
  for (let i = 0; i < nums.length; i++) {
    result = BigInt(nums[i]) * result;
    if (result > Math.pow(10, 18)) return BigInt(-1);
  }
  

  return result;
}
//  [python]
N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
dist = 0
for x1, y1 in XY:
    for x2, y2 in XY:
        dist += ((x1 - x2)**2 + (y1 - y2)**2)**(1/2)
print(dist/N)
//  [python]
N=int(input())
X =  [0] * N
Y =  [0] * N
for i in range(N):
    x,y = map(int,input().split())
    X[i] = x
    Y[i] = y
long = 0
for i in range(N-1):
    for j in range(i+1,N):
        l = ((X[i] - X[j])**2 + (Y[i] - Y[j])**2)**(1/2)
        long += l

ans = long*2/N
print(ans)
//  [python]
N = int(input())


x = []
y = []
for i in range(N):
    tmp = [int(i) for i in input().split()]
    x.append(tmp[0])
    y.append(tmp[1])

d_list = []
for i in range(N):
    for j in range(N):
        dx = x[i] - x[j]
        dy = y[i] - y[j]
        distance = (dx**2 + dy**2)**(0.5)
        d_list.append(distance)

print(sum(d_list)/N)
//  [python]
import numpy as np
import itertools
from itertools import permutations

N = int(input())
XY = [list(map(int, input().split())) for i in range(N)]
Distance = []
for v in itertools.permutations(XY, N):
  distance_each = [np.sqrt((v[i][0] - v[i + 1][0])**2 + (v[i][1] - v[i + 1][1])**2) for i in range(N - 1)]
  distance = np.sum(distance_each)
  Distance.append(distance)
ans = np.average(Distance)
print(ans)
//  [python]
#むちゃくちゃ大事
#街の数を受け取り、その経路の平均値を求めるプログラム


import numpy as np

import math

#街の数を受けとる
n = int(input())

#街の位置ベクトルを保存するためのリスト
a = []

#合計値
sum = 0

#街の一ベクトルを取得
for i in range(n):
    a.append(np.array(list(map(int,input().split()))))

for i in range(n):
    for s in range(i,n):
        sum += np.linalg.norm(a[s] - a[i])

#平均値を表示 sum : 経路の合計  math.factorial(n) : nの階乗
print(sum*2/n)
//  [python]
import math
import itertools
N=int(input())
K=[list(map(int,input().split())) for i in range(N)]
point = list(range(N))

#distance of all edges
dist_list = []
for v in itertools.combinations(point,2):
    dist = math.sqrt((K[v[0]][0] - K[v[1]][0])**2 + (K[v[0]][1] - K[v[1]][1])**2)
    dist_list.append([list(v),dist])

sum = 0
for v in itertools.permutations(point,N):
    for i in range(N-1):
        p1,p2 = v[i],v[i+1]

        for item in dist_list:
            if [p1,p2] in item or [p2,p1] in item:
                sum += item[1]
                break
        

ans = sum / math.factorial(N)

print(ans)
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int N = reader.nextInt();
        double[] X = new double[N];
        double[] Y = new double[N];
        for (int i=0; i<N; i++) {
            X[i] = (double)reader.nextInt();
            Y[i] = (double)reader.nextInt();
        }
        double sum = 0.0;
        for (int i=0; i<N; i++) {
            for (int j=i+1; j<N; j++) {
                sum += Math.sqrt(Math.pow(X[i]-X[j],2)+Math.pow(Y[i]-Y[j],2));
            }
        }
        System.out.println(sum*2.0/(double)N);
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int[] x = new int[N];
		int[] y = new int[N];
		double ans = 0;
		for (int i = 0; i < N; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
		}
		int num = 1;
		for (int i = 1; i < N; i++) {
			num *= i;
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				if (i == j) continue;
				ans += Math.sqrt(Math.pow(x[i]-x[j],2) + Math.pow(y[i]-y[j],2)) * num;
			}
		}
		ans /= num * N;
		System.out.println(ans);
	}


	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
//  [java]

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

public class Main
{
  static double x[] = new double[8];
  static double y[] = new double[8];
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);

    for(int i = 0; i < n; i++)
    {
      s = r.readLine();
      sl = s.split(" ");
      x[i] = Double.parseDouble(sl[0]);
      y[i] = Double.parseDouble(sl[1]);
    }

//    int v = 1;
//    double a = 0;
//    for(int i = 0; i < n; i++)
//    {
//      v *= i + 1;
//      ArrayList<Integer> arr = new ArrayList<>();
//      arr.add(i);
//      a += sum(n, i, 1 << i, arr);
//    }
//    System.out.println(v);
//
//    System.out.println(a / v);

    double a = 0;
    for(int i = 0; i < n; i++)
    {
      for(int j = i; j < n; j++)
      {
        a += Math.sqrt((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]));
      }
    }

    System.out.println(a * 2 / n);
  }


  public static double sum(int n, int start, int mask, List<Integer> v)
  {
    double a = 0;
    for(int i = 0; i < n; i++)
    {
      if((mask & (1 << i)) == 0)
      {
        v.add(i);
        a += sum(n, i, mask | (1 << i), v) +  Math.sqrt((x[start] - x[i]) * (x[start] - x[i]) + (y[start] - y[i]) * (y[start] - y[i]));
        v.remove(v.size() - 1);
      }
    }
    return a;
  }

}




class RemRing
{
 long module;
 public RemRing(long module)
 {
   this.module = module;
 }

 public long sum(long a, long b)
 {
   return (a + b + module) % module;
 }

 public long sub(long a, long b)
 {
   return (a - b + module) % module;
 }

 public long prod(long a, long b)
 {
   return (a * b) % module;
 }

 public long div(long a, long b)
 {
   return (a * inv(b)) % module;
 }

 public long inv(long a)
 {
   long b = this.module;
   long u = 1;
   long v = 0;
   while(b > 0)
   {
     long t = a / b;
     a -= t * b;
     u -= t * v;
     long z = a;
     a = b;
     b = z;
     z = u;
     u = v;
     v = z;
   }
   u %= this.module;
   if(u < 0) u += this.module;
   return u;
 }
}
//  [java]
import java.math.BigDecimal;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.stream.Collector;
import java.util.stream.IntStream;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();


        int[][] pos = new int[n][2];

        for (int cnt = 0; cnt < n; cnt++) {
            pos[cnt][0] = scanner.nextInt();
            pos[cnt][1] = scanner.nextInt();
        }

        String st = IntStream.range(0, n).mapToObj(it -> "" + it)
                .collect(Collector.of(StringBuilder::new, StringBuilder::append, StringBuilder::append, StringBuilder::toString));
        ArrayList<String> list = new ArrayList<>();
        permutation(st, "", list);

        BigDecimal bigDecimal = IntStream.range(0, factorial(n))
//        OptionalDouble average = IntStream.range(0, n)
                .mapToObj(list::get)
                .map(it -> {
//                    System.out.println(it);
                    char[] chars = it.toCharArray();
//                    double result = 0;
                    BigDecimal result = BigDecimal.ZERO;
                    for (int idx = 1; idx < chars.length; idx++) {
                        int pos1 = Integer.parseInt(chars[idx - 1] + "");
                        int pos2 = Integer.parseInt(chars[idx] + "");
//                        System.out.println(pos1 + "," + pos2);
                        result = result.add(new BigDecimal(distance(pos[pos1][0], pos[pos1][1], pos[pos2][0], pos[pos2][1])), MathContext.DECIMAL128);
//                        result += ;
                    }

                    return result;
                })
                .reduce(BigDecimal.ZERO, BigDecimal::add)
                .divide(new BigDecimal(factorial(n) + ""), MathContext.DECIMAL128);
//                .divide(new BigDecimal(""))
//                .get();

        System.out.println(bigDecimal.toString());
    }

    static String distance(int x1, int y1, int x2, int y2) {
        return "" + Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
    }

    static int factorial(int n) {
        int fact = 1;
        if (n == 0) return fact;
        else {
            for (int i = n; i > 0; i--) fact *= i;
            return fact;
        }
    }

    // http://chakotay.jugem.jp/?eid=612
    public static void permutation(String q, String ans, ArrayList<String> result) {
        // Base Case
        if (q.length() <= 1) {
//            System.out.println(ans + q);
            result.add(ans + q);
        }
        // General Case
        else {
            for (int i = 0; i < q.length(); i++) {
                permutation(q.substring(0, i) + q.substring(i + 1), ans + q.charAt(i), result);
            }
        }
    }
}
//  [java]
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

  private final static List<String> permutation = new ArrayList<>();

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    int[] x = new int[n];
    int[] y = new int[n];

    StringBuilder input = new StringBuilder();
    for (int i = 0; i < n; i++) {
      x[i] = sc.nextInt();
      y[i] = sc.nextInt();
      input.append(i + 1);
    }

    permutation(input.toString(), "");
    BigDecimal sum = new BigDecimal(0);
    for (String s : permutation) {
      for (int j = s.length(); j > 1; j--) {
        int firstIndex = Character.getNumericValue(s.charAt(j - 1)) - 1;
        int secondIndex = Character.getNumericValue(s.charAt(j - 2)) - 1;
        int xSum = x[firstIndex] - x[secondIndex];
        int ySum = y[firstIndex] - y[secondIndex];
        sum = sum.add(BigDecimal.valueOf(Math.sqrt(Math.pow(xSum, 2) + Math.pow(ySum, 2))));
      }
    }
    System.out.println(sum.divide(new BigDecimal(permutation.size()), 8, RoundingMode.DOWN).doubleValue());
  }

  public static void permutation(String q, String ans) {
    if (q.length() <= 1) {
      permutation.add(ans + q);
    } else {
      for (int i = 0; i < q.length(); i++) {
        permutation(q.substring(0, i) + q.substring(i + 1),
            ans + q.charAt(i));
      }
    }
  }
}
//  [cpp]
 #include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long

long double calc(int a,int b,int c,int d){
    return sqrt(abs(a - b) * abs(a - b) + abs(c - d) * abs(c - d));
}

int fact(int N){
    int re = 1;
    for (int i = 2; i <= N;i++)
    {
        re *= i;
    }
    return re;
}
int main(){
    int N;
    cin >> N;
    vector<ll> X(N);
    vector<ll> Y(N);
    for (int i = 0; i < N;i++)
    {
        cin >> X[i] >> Y[i];
    }
     long double ans = 0.0;
    for (int i = 0; i < N;i++)
    {
        for (int j = i + 1; j < N;j++)
        {
            ans += calc(X[i], X[j], Y[i], Y[j]);
        }
    }
    long double pre = (long double)N / 2;
    ans = ans / pre;
    cout << fixed << ans << setprecision(16)<< endl;
}
//  [cpp]
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
ld n,a[8],b[8],tot;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            tot+=sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
        }
    }
    cout<<setprecision(15)<<tot*2/n<<endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<pair<double,double>>data(n);
  double sum = 0;
  for(int i = 0;i < n;i++) cin >> data[i].first >> data[i].second;
  for(int i = 0;i < n;i++){
    for(int j = i;j < n;j++){
      sum += sqrt((data[i].first-data[j].first)*(data[i].first-data[j].first)+(data[i].second-data[j].second)*(data[i].second-data[j].second));
    }
  }
  sum /= n;
  std::cout << std::fixed;
  std::cout << std::setprecision(7) << 2*sum << endl;;
}
//  [cpp]
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cmath>


int main(){
  
  // read problem
  long long int N, tmp1, tmp2;
  std::vector<long long int> x, y;
  
  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    x.push_back(tmp1);
    y.push_back(tmp2);
  }
  
  long long int max = 1;
  for(long long int i = 0; i < N; i++){
    max *= N;
  }
  
  int flag;
  double count = 0.0;
  double p1, p2;
  double dist;
  double ans = 0.0;
  std::vector<long long int> visited(N);
  std::vector<long long int> visit(N);
  
  // solve problem
  for(long long int i = 0; i < max; i++){ // for all order
    
    //std::cerr << "i = " << i << std::endl << "visit" << std::endl;
    for(long long int j = 0; j < N; j++){
      visited[j] = 0;
    }
    
    tmp1 = i;
    flag = 1;
    for(long long int j = 0; j < N; j++){
      visit[j] = tmp1%N;
      tmp1 /= N;
      if(visited[visit[j]] != 0){
        flag = 0;
        break;
      }visited[visit[j]] = 1;
    }
    
    if(flag == 1){
      count++;
      dist = 0.0;
      for(long long int j = 1; j < N; j++){
        dist += std::sqrt(((double)x[visit[j-1]] - x[visit[j]])*(x[visit[j-1]] - x[visit[j]])+((double)y[visit[j-1]] - y[visit[j]])*(y[visit[j-1]] - y[visit[j]]));
      }
      ans = ans * (count-1.0)/count + dist/count;
    }
    /*tmp1 = i;
    p1 = tmp1%N;
    visited[p1] = 1;
    //std::cerr << p1 << " " << std::endl;
    flag = 0;
    dist = 0.0;
    
    for(long long int j = 1; j < N; j++){
      // update state
      tmp1 /= N;
      p2 = p1;
      p1 = tmp1%N;
      //std::cerr << p1 << " " << std::endl;
      // check second visit
      if(visited[p1] != 0){
        flag = 1;
      }visited[p1] = 1;
      
      dist += std::sqrt(((double)x[p1] - x[p2])*(x[p1] - x[p2])+((double)y[p1] - y[p2])*(y[p1] - y[p2]));
    }*/
    
    
    
    //if(flag == 0){
      //count++;
      //ans = ans * (count-1.0)/count + dist/count;
      /*std::cerr << "success" << std::endl;
      std::cerr << "count = " << count << std::endl;
      std::cerr << "ans = " << ans << std::endl;*/
   // }
  }
  
  std::cerr << "Answer:" << std::endl;
  std::cout << std::setprecision(15) << ans << std::endl;

  return 0;
}
//  [cpp]
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

bool ok(int i, int n){
  int tmp = i;
  int l[10]={};
  while(tmp>0){
    int tmp2 = tmp % 10;
    tmp /= 10;
    if(l[tmp2] != 0) return false;
    else l[tmp2]++; 
  }
  REP(j,10){
    if(j>=1 && j <= n && l[j] != 1) return false;
    if(j==0 || j >n){
      if(l[j]!=0) return false;
    }
  }
  return true;
}
int fac(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  double ans = 0;
  cin >> N;
  vector<int> x(N),y(N);
  REP(i,N){
    cin >> x[i] >> y[i];
  }
  //double a = (double)sqrt( (x[2]-x[1])*(x[2]-x[1]) + (y[2]-y[1])*(y[2]-y[1]) );
  //cout << a;
  double d[N][N];
  REP(i,N)REP2(j,i+1,N){
    d[i][j] = (double)sqrt( (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
    d[j][i] = (double)sqrt( (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
    //cout << i << j << d[i][j] << endl;
  }
  REP(i,87654322){
    int tmp = i;
    if(ok(tmp,N)){
     // cout << tmp << endl;
      int tmp2 = i;
      int city[10];
      REP(j,N){
        city[j] = tmp2 % 10;
        tmp2 /= 10;
      }
      REP(j,N-1){
        ans += d[city[j]-1][city[j+1]-1];
      }
    }
  }
  ans /= fac(N);
  cout << setprecision(8) << ans;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#include <cxxabi.h>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

char *demangle(const char *demangle)
{
    int status;
    return abi::__cxa_demangle(demangle, 0, 0, &status);
}
double dist(int i, int j, vector<pair<double, double>> vec)
{
    double dx = vec[i].first - vec[j].first;
    double dy = vec[i].second - vec[j].second;
    debug(dx);
    debug(dy);

    return pow(dx * dx + dy * dy, 0.5);
}

int main()
{

    int N;
    cin >> N;
    vector<pair<double, double>> vec(N);
    rep(i, N) cin >> vec[i].first >> vec[i].second;
    // rep(i, N)
    // {
    //     cout << vec[i].first << ' ' << vec[i].second << endl;
    // }
    // cout << endl;

    vector<int> a(N);
    rep(i, N) a[i] = i + 1;

    double ans = 0.0, cnt = 0;
    do
    {
        cnt++;
        for (int i = 0; i < N - 1; i++)
        {
            ans += dist(a[i] - 1, a[i + 1] - 1, vec);
        }
    } while (next_permutation(all(a)));
    debug(cnt);
    debug(ans);
    cout << fixed << setprecision(10);
    cout << ans / cnt << endl;
    return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>
int main(void)
{
  int n;
  scanf("%d",&n);
  double x[n+1],y[n+1];
  for(int i=1;i<=n;i++){
    scanf("%lf%lf",&x[i],&y[i]);
  }
  double length_sum=0.0;
  for(int i=1;i<n;i++){
    for(int j=i+1;j<=n;j++){
      length_sum+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
    }
  }
  int length_number=0;
  for(int i=1;i<n;i++) length_number+=i;
  double ans;
  ans=length_sum*(double)(n-1)/(double)length_number;
  printf("%lf",ans);
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
int main(void) {
	int N, x[8], y[8], i, j; double s = 0;
	scanf("%d", &N);
	for (i = 0; i < N; i++) {scanf("%d %d", &x[i], &y[i]);}
	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			s += sqrt(pow((x[i]-x[j]), 2.0)+pow((y[i]-y[j]), 2.0));
        }
	}
	printf("%.10lf", 2 * s / N);
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <math.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	int N, i, j;
	float sum=0;
	int x[8], y[8];
	
	scanf("%d", &N);
	lop(i, N){
		scanf("%d %d", &x[i], &y[i]);
	}
	
	for(i=0; i<N; i++){
		for(j=i+1; j<N; j++){
			sum+=sqrt(pow(x[i]-x[j],2.0)+pow(y[i]-y[j],2.0));
		}
	}
	
	printf("%f", sum/N*2);
	
return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
int x[8], y[8];
int n;

double dist(int i, int j){
  return sqrt((double)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])));
}

int validroute(int route[]){
  int v[8];
  int i;
  for(i=0;i<n;i++) v[i]=0;
  for(i=0;i<n;i++){
    if(v[route[i]]){
      return 0;
    }
    v[route[i]]++;
  }
  return 1;
}

void increment(int route[],int idx){
  route[idx]++;
  if(idx>0 && route[idx]==n){
    route[idx]=0;
    increment(route,idx-1);
  }
}

int main()
{
  int i;
  int nroute=0;
  double sumdist=0;
  scanf("%d", &n);
  for(i=0;i<n;i++){
	scanf("%d%d", &x[i], &y[i]);
  }
  int route[8]={0,0,0,0,0,0,0,0};
  while(route[0]<n){
    increment(route,n-1);
    if(validroute(route)){
      nroute++;
      for(i=1;i<n;i++){
        sumdist+=dist(route[i-1],route[i]);
      }
    }
  }

  printf("%.10f\n",sumdist/(double)nroute);
  return 0;
}
//  [javascript]
"use strict"

function dist(a, b){
  const xa = a.trim().split(' ').map(Number)[0];
  const ya = a.trim().split(' ').map(Number)[1];
  const xb = b.trim().split(' ').map(Number)[0];
  const yb = b.trim().split(' ').map(Number)[1];
  const X = xa - xb;
  const Y = ya - yb;

  return Math.sqrt(Math.pow(X, 2) + Math.pow(Y, 2))
}

function Main(input) {
  input = input.trim().split('\n');
  const N = Number(input[0]);
  const XY = input.slice(1, input.length);
  
  let sum = 0;
  for(let i=0; i<N; i++){
    for(let j=0; j<N; j++){
      let a = XY[i];
      let b = XY[j];
      sum += dist(a, b);
    }
  }

  console.log(sum/N);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
const fs = require('fs');

let N = 0;
let X = [];
let Y = [];

function distance(i, j) {
    return Math.sqrt(Math.pow(X[i] - X[j], 2) + Math.pow(Y[i] - Y[j], 2));
}

function calcTotalRouteDistance() {
    let result = 0;
    for(let i = 0; i < N-1; ++i) {
        for(let j = i+1; j < N; ++j) {
            result += distance(i, j);
        }
    }
    return result;
}

function calcAverageDistance() {
    return 2 * calcTotalRouteDistance() / N;
}

function main(arg) {
    const lines = arg.split('\n');
    N = parseInt(lines[0], 10);
    for(let i = 0; i < N; ++i) {
        let line = lines[i + 1].split(/\s/);
        X[i] = parseInt(line[0], 10);
        Y[i] = parseInt(line[1], 10);
    }
    console.log(calcAverageDistance());
}

main(fs.readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
  var lines = input.split("\n").filter(v=>v!=='')
  var body = lines.slice(1)

  var n = +lines.slice(0,1)
  var poss = body.map(s=>s.split(' ').map(v=>+v))
  var cache = {}
  var sum = 0

  var diff = (x1,y1,x2,y2) => {
    var v = Math.sqrt(((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)))
    return v
  }

  var f = (past_poss,use_poss) => {
    if(use_poss.length == 0) {
      var d = 0;
      for(var i=1;i<past_poss.length;i++){
        var x = +past_poss[i-1][0]
        var y = +past_poss[i-1][1]
        var _x = +past_poss[i][0]
        var _y = +past_poss[i][1]
        sum += diff(x,y,_x,_y)
      }
      return
    }
    use_poss.forEach(_pos=>{
      //sum += diff(x,y,_x,_y)
      f([...past_poss,_pos],use_poss.filter(__pos=>__pos.toString() != _pos.toString()))
    })
  }
  poss.forEach(_pos=>{
    f([_pos],poss.filter(__pos=>__pos.toString() != _pos.toString()))
  })
  var b = 1
  for(;n>0;n--){
    b *=  n
  }
  console.log(sum/b)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = new Array(N);
  for(var i = 0; i < N; i++){
    list[i] = nextIntArray();
  }
  var avg = 0;
  dfs([]);
  var kaijo = 1;
  for(var i = 1; i <= N; i++){
    kaijo *= i;
  }
  myout(avg / kaijo);

  function dfs(used){
    if(used.length == N){
      var sum = 0;
      for(var i = 1; i < used.length; i++){
        var mae = list[used[i - 1]];
        var ato = list[used[i]];
        sum += Math.sqrt(Math.pow(Math.abs(mae[0] - ato[0]) , 2) + Math.pow(Math.abs(mae[1] - ato[1]) , 2));
      }
      avg += sum;
      return;
    }
    for(var i = 0; i < N; i++){
      if(used.indexOf(i) == -1){
        var tmp = makeClone(used);
        tmp.push(i);
        dfs(tmp);
      }
    }
  }
}
//  [javascript]
"use strict";

const permutateWithoutRepetitions = permutationOptions => {
  if (permutationOptions.length === 1) {
    return [permutationOptions];
  }

  // Init permutations array.
  const permutations = [];

  // Get all permutations for permutationOptions excluding the first element.
  const smallerPermutations = permutateWithoutRepetitions(permutationOptions.slice(1));

  // Insert first option into every possible position of every smaller permutation.
  const firstOption = permutationOptions[0];

  for (let permIndex = 0; permIndex < smallerPermutations.length; permIndex += 1) {
    const smallerPermutation = smallerPermutations[permIndex];

    // Insert first option into every possible position of smallerPermutation.
    for (let positionIndex = 0; positionIndex <= smallerPermutation.length; positionIndex += 1) {
      const permutationPrefix = smallerPermutation.slice(0, positionIndex);
      const permutationSuffix = smallerPermutation.slice(positionIndex);
      permutations.push(permutationPrefix.concat([firstOption], permutationSuffix));
    }
  }

  return permutations;
}
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const xy = arg.slice(1, N + 1).map(n=>n.split(" ").map(l=>parseInt(l)));
    
    const combos = permutateWithoutRepetitions(xy);
    const results = [];
    
    for(let i in combos) {
        let temp = 0;
        
        for(let j=0; j<combos[i].length-1; j++) {

            let x = Math.pow(combos[i][~~j + 1][0] - combos[i][j][0], 2);
            let y = Math.pow(combos[i][~~j + 1][1] - combos[i][j][1], 2);

            temp += Math.sqrt(x + y);
        }

        results.push(temp)
    }
    
    console.log(results.reduce((m,n)=>m+n) / combos.length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"math"
)

// 全部列挙する

func main() {
	var n int
	fmt.Scan(&n)

	positions := make([][]int, n)
	for i :=0; i < n; i++ {
		var x, y int
		fmt.Scan(&x, &y)
		positions[i] = []int{x,y}
	}

	ans := 0.0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}
			diffX := float64(positions[i][0] - positions[j][0])
			diffY := float64(positions[i][1] - positions[j][1])
			ans += math.Sqrt(diffX*diffX + diffY*diffY)
		}
	}
	fmt.Println(ans/float64(n))
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]int, n)
	ys := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&xs[i], &ys[i])
	}

	var total float64
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i != j {
				d1 := xs[i] - xs[j]
				d2 := ys[i] - ys[j]
				d := math.Sqrt(float64(d1*d1 + d2*d2))
				total += d
			}
		}
	}

	avg := total / float64(n)
	fmt.Print(avg)
}

//
//func factorial(n int) int {
//	if n <= 1 {
//		return 1
//	}
//	return n * factorial(n-1)
//}
//  [go]
package main

import (
	"fmt"
	"math"
)

type point struct {
	X, Y float64
}

func main() {
	var N int
	fmt.Scanf("%d", &N)

	L := make([]point, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&L[i].X, &L[i].Y)
	}

	ans := 0.0
	for _, A := range L {
		for _, B := range L {
			ans += math.Hypot((A.X - B.X), (A.Y - B.Y))
		}
	}
	ans /= float64(N)

	fmt.Println(ans)
}