#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<queue>
#include<list>
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
#define mmt(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define mp make_pair
#define y1 fuck
#define N 1000100
#define M 100100
#define triit list<tri>::iterator
using namespace std;
typedef long long LL;
typedef long double LD;
struct tri{int x,y,d,ar;}a[M];
list<tri> tl;
triit dlist[M];
int now_len=0,n,last_len=0,al[N];
bool cmp(tri a,tri b)
{
return a.y<b.y||(a.y<b.y&&a.x<b.x);
}
void add(int x){if (al[x]==0) now_len++;al[x]++;}
void del(int x){al[x]--;if (al[x]==0) now_len--;}
int main()
{
ios::sync_with_stdio(false);
scanf("%d",&n);int i,t2=0;
int nt=0,tx,ty,td;
FOR(i,1,n)
{
scanf("%d%d%d",&tx,&ty,&td);
if (td)
{
a[++nt].x=tx;a[nt].y=ty;a[nt].d=td;
a[nt].ar=a[nt].d+a[nt].x-1;t2=max(t2,a[nt].y+a[nt].d);
}
}
n=nt;
sort(a+1,a+1+n,cmp);
int t1=a[1].y;
a[n+1].y=100000000;
double ans=0;
int j=1,k;
FOR(i,t1,t2)
{
int lt=0,last_len=now_len;
for(triit it=tl.begin();it!=tl.end();it++)
{
del((*it).ar);
(*it).ar--;
if ((*it).ar==(*it).x-1) dlist[++lt]=it;
}
FOR(k,1,lt) tl.erase(dlist[k]);
if (i!=t1) ans+=(last_len*1.00+now_len*1.00)/2.00;
while (i==a[j].y&&j<=n)
{
tl.pb(a[j]);
FOR(k,a[j].x,a[j].ar) add(k);
j++;
}
}
printf("%.1lf\n",ans);
return 0;
}