#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef pair<double,double> pdd;
const int N=40010;
const double pi=acos(-1);
int n,cnt;
pdd q[N];
int stk[N],top;
bool used[N];
pdd rotate(pdd a,double b){
return {a.x*cos(b)+a.y*sin(b),-a.x*sin(b)+a.y*cos(b)};
}
pdd operator-(pdd a,pdd b){
return {a.x-b.x,a.y-b.y};
}
double cross(pdd a,pdd b){
return a.x*b.y-a.y*b.x;
}
double area(pdd a,pdd b,pdd c){
return cross(b-a,c-a);
}
double get_dist(pdd a,pdd b){
double dx=a.x-b.x;
double dy=a.y-b.y;
return sqrt(dx*dx+dy*dy);
}
double solve(){
sort(q,q+cnt);
for(int i=0;i<cnt;i++){
while(top>=2&&area(q[stk[top-1]],q[stk[top]],q[i])>0)
used[stk[top--]]=false;
stk[++top]=i;
used[i]=true;
}
used[0]=false;
for(int i=cnt-1;i>=0;i--){
if(used[i]) continue;
while(top>=2&&area(q[stk[top-1]],q[stk[top]],q[i])>0)
top--;
stk[++top]=i;
}
double ans=0;
for(int i=2;i<=top;i++){
ans+=get_dist(q[stk[i-1]],q[stk[i]]);
}
return ans;
}
int main(){
scanf("%d",&n);
double a,b,r;
scanf("%lf%lf%lf",&a,&b,&r);
a=a/2-r,b=b/2-r;
int dx[]={1,1,-1,-1},dy[]={1,-1,1,-1};
while(n--){
double x,y,z;
scanf("%lf%lf%lf",&x,&y,&z);
for(int i=0;i<4;i++){
pdd t=rotate({dx[i]*b,dy[i]*a},-z);
q[cnt++]={x+t.x,y+t.y};
}
}
double ans=solve();
printf("%.2lf\n",ans+2*pi*r);
return 0;
}