#include<bits/stdc++.h>
using namespace std;
int n,top;double ans,a,b,r;
struct vec{double x,y;}p[100001],s[100001];
vec operator -(vec a,vec b){return vec{b.x-a.x,b.y-a.y};}
double operator *(vec a,vec b){return a.x*b.y-a.y*b.x;}
double norm(vec a){return sqrt(a.x*a.x+a.y*a.y);}
bool cmp(vec a,vec b){return (a-p[1])*(b-p[1])>0?1:((a-p[1])*(b-p[1])==0&&norm(a)<norm(b));}
int main(){
cin>>n>>a>>b>>r;
a-=2*r,b-=2*r;
double R=sqrt(a*a+b*b)/2;
double alpha=atan(b/a);
for(int i=1;i<=n;++i){
double x,y,theta;
scanf("%lf%lf%lf",&x,&y,&theta);
p[(i-1)*4+1]=vec{x-R*cos(alpha+theta),x-R*sin(alpha+theta)};
p[(i-1)*4+2]=vec{x-R*cos(theta-alpha),x-R*sin(theta-alpha)};
p[(i-1)*4+3]=vec{x+R*cos(alpha+theta),x+R*sin(alpha+theta)};
p[(i-1)*4+4]=vec{x+R*cos(theta-alpha),x+R*sin(theta-alpha)};
}
n*=4;
for(int i=2;i<=n;++i)
if(p[i].y<p[1].y||(p[i].y==p[1].y&&p[i].x<p[1].x))swap(p[1],p[i]);
sort(p+2,p+n+1,cmp);
s[++top]=p[1];
for(int i=2;i<=n;++i){
while(top>=2&&(s[top]-s[top-1])*(p[i]-s[top])<=0)top--;
s[++top]=p[i];
}
s[top+1]=s[1];
for(int i=1;i<=top;++i)ans+=norm(s[i+1]-s[i]);
printf("%.2lf",ans+2*3.1415926*r);
}