#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define b back
#define cout(x) cout<<x<<endl
#define lb long double
#define sor(arr,n) sort(arr,arr+n)
#define inputVector(v,n) for(int i=0;i<n;i++) cin>>v[i]
#define sov(v) sort(v.begin(),v.end())
#define pl pair<ll,ll>
#define all(a)      (a).begin(),(a).end()
#define vpp vector<pair<ll,ll>>
#define fastIo ios_base::sync_with_stdio(false),cin.tie(0)
#define endl '\n'
typedef long long  int  ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
const int N=100001;
ll P=1e9+7;
void solve() {
    ll i,n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) {
        cin>>a[i];
    }
   sov(a);
   if(n==1) {cout<<a[0]/2<<endl; return;}
   vector<ll> pref(n);
   pref[0]=a[0];
   for(int i=1;i<n;i++) { pref[i]=pref[i-1]+a[i]; }
   long double expectation=LLONG_MAX;
   for(int i=1;i<n;i++) {
       lb val=(a[i]/2.0);
       lb exp=val*n;
       exp+=pref[n-1]-pref[i-1];
       exp-=(n-i)*2*val;
       exp/=n;
       expectation=min(expectation,exp);
   }
   cout<<fixed<<setprecision(10)<<expectation<<endl;
}
int main() {
    ll t=1,i=1;
    fastIo;
    // cin>>t;
    while(t--) {
        solve();
        i++;
    }
    return 0;
}
// may be a binary search too on the probabilities lets see.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e3+9;
const int MAX=6e5+9;
const int MAX1=5e6+9;
const int INF=0x3f3f3f3f;
const double ep=1e-8;
const double ep1=1e-4;
const int mod=998244353;
const double inf=1e20;
const double pi=acos(-1);
#define debug1 puts("?");
#define debug(x) cout<<"##"<<(x)<<endl;
#define mk make_pair
#define PII pair<int,int>
#define PDI pair<double,int>
#define PIII pair<int,PII >
#define PIII1 pair<PII,int>
#define PIIII pair<PII,PII >
#define PIL pair<int,ll>
#define PLI pair<ll,int>
#define PLIII pair<PLI,PII >
#define PLL pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define sd(x) scanf("%d",&(x))
#define slld(x) scanf("%lld",&(x))
#define sdd(x,y) scanf("%d%d",&(x),&(y))
#define sc(s) scanf("%s",(s))
#define pd(x) printf("%d\n",(x))
#define plld(x) printf("%lld\n",(x))
#define pdk(x) printf("%d ",(x))
#define plldk(x) printf("%lld ",(x))
#define pdd(x,y) printf("%d %d\n",(x),(y))
#define PR(x) printf("Case %d: ",(x))
#define INF 0x3f3f3f3f
typedef unsigned long long ull;
/*
*/
struct node{
	int to,nex;
	ll val;
}a[maxn];
int n,m;
int head[maxn],cnt;
void add(int fro,int to,ll val)
{
	a[++cnt].to=to;
	a[cnt].val=val;
	a[cnt].nex=head[fro];
	head[fro]=cnt;
}
ll d[maxn];
void bfs(int x)
{
	priority_queue<PLI,deque<PLI >,greater<PLI > >q;
	q.push(mk(0,x));
	bool ju=0;
	while(!q.empty())
	{
		PLI p=q.top();q.pop();
		int cur=p.se;
		ll val=p.fi;
		if(cur==x&&val)
		{
			plld(val);
			return;
		}
//		cout<<cur<<' '<<val<<endl;
		for(int i=head[cur];i;i=a[i].nex)
		{
			int to=a[i].to;
//			cout<<to<<' '<<a[i].val<<' '<<d[to]<<endl;
			if(val+a[i].val<d[to])
			{
				d[to]=val+a[i].val;
				q.push(mk(d[to],to));
//				if(to==x)ju=1;
			}
		}
	}
	puts("-1");
}
void solve()
{
	sdd(n,m);
	rep(i,1,m)
	{
		int u,v;
		ll w;
		sdd(u,v);
		slld(w);
		add(u,v,w);
	}
	rep(i,1,n)
	{
		memset(d,INF,sizeof d);
		bfs(i);
	}
}
int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int T=1;
//    sd(T);
    while(T--)solve(); 
}
