#include <bits/stdc++.h>
using namespace std;
struct ing {
int x;
int y;
int r;
double p;
int flag = 1;
};
bool comp(const ing& a, const ing& b) {
return a.p < b.p;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
double tot = 0;
int x, y, r;
int n, k;
int cnt = 0;
double tep;
double teq;
int cnu = 0;
ing str[100010];
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> str[i].x >> str[i].y >> str[i].r;
tep = pow(str[i].x, 2) + pow(str[i].y, 2);
teq = pow(str[i].r, 2);
if (tep >= teq) {
str[i].flag = 0;
cnt++;
} else
str[i].p = (str[i].r - sqrt(tep)) * 3.1415926 * str[i].r * str[i].r;
}
if (n - cnt <= k)
cout << "0.0000000000000";
else {
sort(str, str + n, comp);
for (int i = 0; i < n; i++) {
if (str[i].flag) {
tot += str[i].p;
cnu++;
}
if (cnu == n - cnt - k)
break;
}
printf("%.8lf", tot);
}
return 0;
}