#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
const int maxm = 1000 + 10;
int m;
double time = 0.0;
double sl = 0.0;
struct node
{
int u;
int v;
int len;
}r[maxm];
struct node2
{
int s[maxm];
int p;
}t[maxm];
int main()
{
freopen("firelead.in","r",stdin);
freopen("firelead.out","w",stdout);
t[1].p = 0;
cin >> m;
for (int i = 1; i <= m; i++)
cin >> r[i].u >> r[i].v >> r[i].len;
bool b = true;
for (int i = 1; i <= m; i++)
{
if (r[i].len != 1)
{
b = false;
break;
}
else
continue;
}
if(!b)
{
for (int i = 1; i <= m; i++)
{
sl += r[i].len;
}
time = sl / 4 * 3 / 2;
}
else
time = 1;
cout << time;
return 0;
}