#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 1505

struct Point{
    Point(double arg_x,double arg_y){
        x = arg_x;
        y = arg_y;
    }

    Point(){
        x = y = 0.0;
    }

    Point operator + (Point p){ return Point(x+p.x,y+p.y); }
    Point operator - (Point p){ return Point(x-p.x,y-p.y);}
    Point operator * (double a){ return Point(a*x,a*y); }
    Point operator / (double a){ return Point(x/a,y/a); }

    double abs(){ return sqrt(norm()); }
    double norm(){ return x*x + y*y; }

    bool operator<(const Point &p) const{
        return x != p.x? x < p.x: y < p.y;
    }

    bool operator == (const Point &p) const{
        return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
    }

    double x,y;
};

typedef Point Vector;

struct Sphere{
    Point center;
    double r;
};

typedef Sphere Circle;

struct Line{
public:
    Point p[2];
    Line(Point p1,Point p2){
        p[0] = p1;
        p[1] = p2;
    }
    Line(){

    }
};

struct Info{
	bool operator<(const struct Info &arg) const{

		return left > arg.left;
	}
	double left,right;
};

int N,K;
int most_L[SIZE];
vector<Info> work,V;
double dp1[SIZE][SIZE],dp2[SIZE][SIZE];
Circle circle[SIZE];


double NUM = 10000;

double norm(Vector a){
    return a.x*a.x+a.y*a.y;
}

double abs(Vector a){
    return sqrt(norm(a));
}

double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

double dot(Vector a,Vector b){
    return a.x*b.x + a.y*b.y;
}

Point project(Line l,Point p){

    Vector base = l.p[1]-l.p[0];
    double r = dot(p-l.p[0],base)/norm(base);
    return l.p[0]+base*r;
}

//円と直線の交点を求める関数
vector<Point> getCrossPoints(Circle c,Line l){

    vector<Point> ret;

    Vector pr = project(l,c.center);
    Vector e = (l.p[1]-l.p[0])/abs(l.p[1]-l.p[0]);

    double base;

    if(fabs(c.r*c.r-norm(pr-c.center)) < EPS){

        base = 0;
    }else{
        base = sqrt(c.r*c.r-norm(pr-c.center));
    }

    ret.push_back(Point(pr+e*base));
    ret.push_back(Point(pr-e*base));

    return ret;
}

double calc_dist(Point A,Point B){

	return sqrt((A.x-B.x)*(A.x-B.x)+(A.y-B.y)*(A.y-B.y));
}

int calc_area(double deg){

	if(deg >= 0 && deg <= 90){

		return 1;
	}else if(deg <= 180){

		return 2;
	}else if(deg <= 270){

		return 3;
	}else{

		return 4;
	}
}

int main(){

	Point base = Point(0,0);

	scanf("%d %d",&N,&K);

	for(int i = 0; i < N; i++){

		scanf("%lf %lf %lf",&circle[i].center.x,&circle[i].center.y,&circle[i].r);
		if(calc_dist(base,circle[i].center) < circle[i].r){

			printf("1.0\n");
			return 0;
		}
	}

	int area1,area2;

	Line line = Line(Point(0,-10000),Point(0,10000));

	vector<Point> P;

	for(int i = 0; i < N; i++){

		double angle1 = atan2(circle[i].center.y,circle[i].center.x)*(180/M_PI);
		if(angle1 < 0){

			angle1 += 360;
		}
		double angle2 = asin(circle[i].r/abs(circle[i].center))*(180/M_PI);
		if(angle2 < 0){

			angle2 += 360;
		}

		double deg1 = angle1+angle2;
		if(deg1 >= 360){

			deg1 -= 360;
		}

		double deg2 = angle1-angle2;
		if(deg2 < 0){

			deg2 += 360;
		}

		area1 = calc_area(deg1);
		area2 = calc_area(deg2);


		if(area1 != 1 && area2 != 1 && area1 !=2 && area2 != 2)continue;

		if(area1 > area2){
			swap(area1,area2);
			swap(deg1,deg2);
		}

		Info info;
		info.right = deg1;

		if(area1 == 1){

			switch(area2){
			case 1:
			case 2:
				info.left = deg2;
				break;
			case 3:
				P = getCrossPoints(circle[i],line); //注意

				if(P[0].y > 0 && P[1].y > 0){

					info.left = 180;

				}else{

					info.left = 0;
				}

				break;
			case 4:
				info.left = 0;
				break;
			}

		}else{ //area1 == 2

			switch(area2){
			case 2:
				info.left = deg2;
				break;
			case 3:
				info.left = 180;
				break;
			case 4:
				P = getCrossPoints(circle[i],line); //注意

				if(P[0].y > 0 && P[1].y > 0){

					info.left = 0;

				}else{

					info.left = 180;
				}
				break;
			}
		}

		if(info.right > info.left){

			swap(info.left,info.right);
		}
		work.push_back(info);
	}

	bool FLG;
	//他でカバーできる接線のペアは除く
	for(int i = 0; i < work.size(); i++){
		FLG = false;
		for(int k = i+1; k < work.size(); k++){
			if(k == i)continue;

			if(work[k].left >= work[i].left && work[k].right <= work[i].right){

				FLG = true;
				break;
			}
		}
		if(!FLG){

			V.push_back(work[i]);
		}
	}

	sort(V.begin(),V.end()); //leftの降順

	for(int i = 0; i < V.size(); i++){
		most_L[i] = -1;
		for(int k = 0; k < i; k++){
			if(V[k].right > V[i].left+EPS)continue;

			most_L[i] = k;
			break;
		}
	}

	for(int i = 0; i <= K; i++){
		for(int k = 0; k <= V.size(); k++){
			dp1[i][k] = 0;
			dp2[i][k] = 0;
		}
	}

	double maximum = 0;

	for(int i = 1; i <= K; i++){ //使用個数
		for(int k = 1; k <= V.size(); k++){ //最後のindex(本来のindex+1)
			if(most_L[k-1] == -1){

				dp1[i][k] = dp2[i-1][k-1]+V[k-1].left-V[k-1].right;

			}else{ //重なりを持つ区間あり

				dp1[i][k] = max(dp1[i-1][most_L[k-1]+1]+V[most_L[k-1]].right-V[k-1].right,
						dp2[i-1][most_L[k-1]]+V[k-1].left-V[k-1].right);
			}
			dp2[i][k] = max(dp1[i][k],dp2[i][k-1]);

			maximum = max(maximum,dp2[i][k]);
		}
	}

	printf("%.10lf\n",maximum/180.0);

    return 0;
}




Measured memory_bytes: 39032