#include <bits/stdc++.h>
using namespace std;

double dis[105],f[105][105];

int main(){
	int n,k,eps;
	scanf("%d%d%d",&n,&k,&eps);
	int x0,y0;
	scanf("%d%d",&x0,&y0);
	double maxd=0;
	for (int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		dis[i]=sqrt((x-x0)*(x-x0)+(y-y0)*(y-y0));
		maxd=max(maxd,dis[i]);
	}
	double l,r;
	for (l=0,r=maxd;r-l>1e-8;){
		double R=(l+r)/2;
		memset(f,0,sizeof(f));
		f[0][0]=1;
		for (int i=1;i<=n;i++)
			for (int j=0;j<i;j++){
				double p=dis[i]<=R?1:exp(1-dis[i]*dis[i]/R/R);
				f[i][j+1]+=f[i-1][j]*p;
				f[i][j]+=f[i-1][j]*(1-p);
			}
		double s=0;
		for (int i=k;i<=n;i++)
			s+=f[n][i];
		if (s*1000>=1000-eps) r=R;
		else l=R;
	}
	printf("%.7lf",l);
	return 0;
}


//lxrtxdy!
#include<cstring>
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#define maxn 2005
using namespace std;
int n;
int k, e;
double x0, y0;
double x[maxn], y[maxn];
double dp[maxn][maxn];
double buf[maxn];
bool eps(double a) {
	return fabs(a)<1e-8;
}
double dis(double a, double b) {
	return sqrt(a*a+b*b);
}
double pro(double D, double R) {
	if(D<=R) return 1.0;
	return exp(1.0-D*D/(R*R));
}
bool judge(double R) {
	memset(dp,0,sizeof(dp));
	dp[0][0] = 1.0;
	for(int i=1; i<=n; i++) {
		buf[i] = pro(dis(x0 - x[i], y0 - y[i]), R);
	}
	for(int i=1;i<=n;i++) {
		dp[i][0] = (1.0-buf[i])*dp[i-1][0];
		for(int j=1;j<=i;j++) {
			dp[i][j]=buf[i]*dp[i-1][j-1] + (1.0-buf[i])*dp[i-1][j];
		}
	}
	double res = 0;
	for(int i=0;i<k;i++) res += dp[n][i];
//	cout << res << endl;
	return (res<=e*1.0/(1000*1.0));
}
int main() {

	scanf("%d%d",&n,&k);
	scanf("%d",&e);
	scanf("%lf%lf",&x0,&y0);
	double l=0, r=0, ans=0;
	for(int i=1; i<=n; i++) {
		scanf("%lf%lf",&x[i],&y[i]);
		r=max(r,dis(x0 - x[i], y0 - y[i]));
	}
	while(!eps(r-l)) {
		double mid=(r+l)/2;
		if(judge(mid)) {
			ans = mid;
			r = mid;
		} else l = mid;
	}
	printf("%.10lf\n",ans);
}
 	  	 		   	   			    	  	   	//hellobig_tq
//orzlxr!//hello


/* Fairy dandy tickling the fancy of his lady friend */

#include <iostream>

#include <vector>

#include <algorithm>
#include <iomanip>
#include <math.h>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

#define rep(i,a,b) for(int i=int(a); i<int(b); i++)

#define rip(i,a,b) for(int i=(int)a; i>=(int)b; i--)

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

#define sz(x) int(x.size())

#define all(v) (v).begin(), (v).end()

#define trace(x) cerr << #x << ": " << x <<endl;

using namespace std;

typedef long long int lli;

typedef pair<lli, lli> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

long double dp[105];
long double eps;

long double dist(int x0, int y0, int x1, int y1){
	return (x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);
}

long double solve(long double acum, int k){
	return acum/(k-log(1-eps));
}

int main(){

    fastio;

	int n, k; cin>>n>>k;
	cin>>eps;
	eps/=1000;
	int x0, y0, x1, y1;
	vector<long double> R;
	cin>>x0>>y0;
	rep(i, 0, n){
		cin>>x1>>y1;
		R.pb(dist(x1, y1, x0, y0));
	}
	sort(all(R));
	rep(i, 0, k){
		long double acum=0.0;
		rep(j, i, k){
			acum+=R[j];
		}
		long double cur=solve(acum, k-i);
		if(cur>0 && cur>=R[i]) dp[i]=1e9;
		else dp[i]=cur;
	}
	long double ans=1e9;
	rep(i,0,k)ans=min(ans, dp[i]);
	cout<<setprecision(12);
	cout<<sqrt(ans)<<endl;

    return 0;

}


/* Fairy dandy tickling the fancy of his lady friend */

#include <iostream>

#include <vector>

#include <algorithm>
#include <iomanip>
#include <math.h>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

#define rep(i,a,b) for(int i=int(a); i<int(b); i++)

#define rip(i,a,b) for(int i=(int)a; i>=(int)b; i--)

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

#define sz(x) int(x.size())

#define all(v) (v).begin(), (v).end()

#define trace(x) cerr << #x << ": " << x <<endl;

using namespace std;

typedef long long int lli;

typedef pair<lli, lli> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

const long double EPS=1e-8;

long double D[105];
long double dp[105][105];
long double eps;
int n, k;

long double dist(int x0, int y0, int x1, int y1){
	return (x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);
}

long double prob(long double d, long double R){
	if(d+EPS<=R*R) return 1;
	else return exp(1-d/(R*R));
}

bool check(long double R){
	rep(i, 0, n+1) rep(j, 0, n+1) dp[i][j]=0;
	dp[0][0]=1;
	rep(i, 1, n+1){
		//trace(i);
		long double p=prob(D[i], R);
		//trace(p);
		rep(j, 1, i+1){
			//trace(j);
			dp[i][j]= dp[i-1][j-1]*p + dp[i-1][j]*(1-p);
			//trace(dp[i][j]);
		}
	}
	long double cur=0.0;
	rep(i, k, n+1) cur+=dp[n][i];
	//trace(cur);
	return (1-cur)<=eps;
}

int main(){

    fastio;

	cin>>n>>k;
	cin>>eps;
	eps/=1000;
	int x0, y0, x1, y1;
	cin>>x0>>y0;
	rep(i, 1, n+1){
		cin>>x1>>y1;
		D[i]=dist(x1, y1, x0, y0);
	}
	long double l=0, r=1000;
	while(r-l>EPS){
		long double mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid;
	}
	cout<<setprecision(12)<<(l+r)/2<<endl;

    return 0;

}


/* Fairy dandy tickling the fancy of his lady friend */

#include <iostream>

#include <vector>

#include <algorithm>
#include <iomanip>
#include <math.h>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

#define rep(i,a,b) for(int i=int(a); i<int(b); i++)

#define rip(i,a,b) for(int i=(int)a; i>=(int)b; i--)

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

#define sz(x) int(x.size())

#define all(v) (v).begin(), (v).end()

#define trace(x) cerr << #x << ": " << x <<endl;

using namespace std;

typedef long long int lli;

typedef pair<lli, lli> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

const long double EPS=1e-8;

long double D[105];
long double dp[105][105];
long double eps;
int n, k;

long double dist(int x0, int y0, int x1, int y1){
	return (x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);
}

long double prob(long double d, long double R){
	if(d<=R*R+EPS) return 1;
	else return exp(1-d/(R*R));
}

bool check(long double R){
	rep(i, 0, n+1) rep(j, 0, n+1) dp[i][j]=0;
	dp[0][0]=1;
	//trace(R);
	rep(i, 1, n+1){
		//trace(i);
		long double p=prob(D[i], R);
		//trace(p);
		rep(j, 0, i+1){
			//trace(j);
			dp[i][j]= (k>0 ?  dp[i-1][j-1]*p : 0 ) + dp[i-1][j]*(1-p);
			//trace(dp[i][j]);
		}
	}
	long double cur=0.0;
	rep(i, k, n+1) cur+=dp[n][i];
	return cur >= 1-eps;
}

int main(){

    fastio;

	cin>>n>>k;
	cin>>eps;
	eps/=1000;
	int x0, y0, x1, y1;
	cin>>x0>>y0;
	rep(i, 1, n+1){
		cin>>x1>>y1;
		D[i]=dist(x1, y1, x0, y0);
	}
	long double l=0, r=2000000;
	while(r-l>EPS){
		long double mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid;
	}
	cout<<setprecision(12)<<(l+r)/2<<endl;

    return 0;

}


/* Fairy dandy tickling the fancy of his lady friend */

#include <iostream>

#include <vector>

#include <algorithm>
#include <iomanip>
#include <math.h>

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

#define rep(i,a,b) for(int i=int(a); i<int(b); i++)

#define rip(i,a,b) for(int i=(int)a; i>=(int)b; i--)

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

#define sz(x) int(x.size())

#define all(v) (v).begin(), (v).end()

#define trace(x) cerr << #x << ": " << x <<endl;

using namespace std;

typedef long long int lli;

typedef pair<lli, lli> ii;

typedef vector<int> vi;

typedef vector<ii> vii;

const long double EPS=1e-8;

long double D[105];
long double dp[105][105];
long double eps;
int n, k;

long double dist(int x0, int y0, int x1, int y1){
	return (x1-x0)*(x1-x0)+(y1-y0)*(y1-y0);
}

long double prob(long double d, long double R){
	if(d<=R*R+EPS) return 1;
	else return exp(1-d/(R*R));
}

bool check(long double R){
	rep(i, 0, n+1) rep(j, 0, n+1) dp[i][j]=0;
	dp[0][0]=1;
	//trace(R);
	rep(i, 1, n+1){
		//trace(i);
		long double p=prob(D[i], R);
		//trace(p);
		rep(j, 0, i+1){
			//trace(j);
			dp[i][j]= (k>0 ?  dp[i-1][j-1]*p : 0 ) + dp[i-1][j]*(1-p);
			//trace(dp[i][j]);
		}
	}
	long double cur=0.0;
	rep(i, k, n+1) cur+=dp[n][i];
	return cur >= 1-eps;
}

int main(){

    fastio;

	cin>>n>>k;
	cin>>eps;
	eps/=1000;
	int x0, y0, x1, y1;
	cin>>x0>>y0;
	rep(i, 1, n+1){
		cin>>x1>>y1;
		D[i]=dist(x1, y1, x0, y0);
	}
	long double l=0, r=1000;
	while(r-l>EPS){
		long double mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid;
	}
	cout<<setprecision(12)<<(l+r)/2<<endl;

    return 0;

}


#include <algorithm>
#include <bitset>
#include <deque>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <iomanip>
#include <vector>

#define fst first
#define snd second
#define all(x) (x).begin(), (x).end()
#define clr(a, v) memset( a , v , sizeof(a) )
#define pb push_back
#define mp make_pair
#define sz size()
#define FORN( i , s , n ) for( int64 i = (s) ; i < (n) ; i++ )
#define FOR( i , n ) FORN( i , 0 , n )
#define FORIT( i , x ) for( typeof x.begin() i = x.begin() ; i != x.end() ; i++ )
#define trace(x)    cout << #x << ": " << x << endl;
#define trace2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define read ios::sync_with_stdio(false)

using namespace std;

typedef long long int64;
typedef vector <int64> vi;
typedef pair <int64,int64> ii;
typedef vector <string> vs;
typedef vector <ii> vii;

double EPS = 1e-8;

int cmp(double a, double b){
    return  (a+EPS<b)?-1:(a-EPS>b)?1:0;
}

int64 N;
int K; double E;
double X[105],Y[105],Xo,Yo;
double e = 2.7182818284590452353602874713527;
double p[105];

double prob(int i, double R){
    double d =  ( X[i]-Xo )*( X[i]-Xo ) + ( Y[i]-Yo )*( Y[i]-Yo ) ;
    if ( cmp(d,R*R)<=0 ) return 1.0; else return exp(1.0-((d)/(R*R)) );
}

double calc(){
    double ans = 0.0;
    double DP[N+1][N+1];

    clr(DP,0);
    DP[0][0] = 1.0;
    FORN(i,1,N+1) FOR(j,N+1){
        if( j>i ) continue;
        if( j==0 ) DP[i][j] = DP[i-1][j]*(1.0-p[i-1]);
        else DP[i][j] = DP[i-1][j]*(1.0-p[i-1]) + DP[i-1][j-1]*p[i-1];
    }

    FORN(k,K,N+1)
        ans+=DP[N][k];
    return ans;
}

int main(){
    read;
    cin>>N;
    cin>>K>>E;
    E/=1000.0;
    E = 1.0-E;
    cin>>Xo>>Yo;
    double lo = 0.0, hi =0.0,mi;
    FOR(i,N) {
        cin>>X[i]>>Y[i];
        hi = max(hi, sqrt( ( X[i]-Xo )*( X[i]-Xo ) + ( Y[i]-Yo )*( Y[i]-Yo ) ) +10.0 );
    }
    FOR(i,60){
        mi = (lo+hi)/2.0;
        FOR(i,N) p[i] = prob(i,mi);

        //trace(mi);
        //trace(calc());

        if ( cmp(calc(),E)>=0 ) hi = mi;
        else lo = mi;
    }
    printf("%.9lf\n",mi);
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

#define N 1020

int x[N], y[N];
int n, k;
double e;
long double p[N], dp[N][N];

double dis(int i, int j) {
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return dx * dx + dy * dy;
}

bool check(double r) {
	for(int i = 1; i <= n; ++i) {
		double d = dis(0, i);
		if(d <= r * r) p[i] = 1;
		else p[i] = exp(1 - d / r / r);
	}
	dp[0][0] = 1;
	for(int i = 1; i <= n; ++i) {
		for(int j = 0; j <= i; ++j) {
			dp[i][j] = (1 - p[i]) * dp[i-1][j];
			if(j > 0) dp[i][j] += dp[i-1][j-1] * p[i];
		}
	}
	double res = 0;
	for(int i = k; i <= n; ++i) res += dp[n][i];
	if(res >= 1 - e) return 1;
	return 0;
}

int main() {
	scanf("%d%d%lf", &n, &k, &e);
	e /= 1000;
	int cnt = 0;
	for(int i = 0; i <= n; ++i) {
		scanf("%d%d", &x[i], &y[i]);
		if(x[i] == x[0] && y[i] == y[0]) ++cnt;
	}
	if(cnt >= k + 1) {
		puts("0");
		return 0;
	}
	double l = 1, r = 1e5;

	while(r - l > 1e-8) {
		double m = (l + r) / 2;
		if(check(m)) r = m;
		else l = m;
	}
	printf("%.12lf\n", l);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

#define N 1020

int x[N], y[N];
int n, k;
double e;
long double p[N], dp[N][N];

double dis(int i, int j) {
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return dx * dx + dy * dy;
}

bool check(double r) {
	for(int i = 1; i <= n; ++i) {
		double d = dis(0, i);
		if(d <= r * r) p[i] = 1;
		else p[i] = exp(1 - d / r / r);
	}
	dp[0][0] = 1;
	for(int i = 1; i <= n; ++i) {
		for(int j = 0; j <= i; ++j) {
			dp[i][j] = (1 - p[i]) * dp[i-1][j];
			if(j > 0) dp[i][j] += dp[i-1][j-1] * p[i];
		}
	}
	double res = 0;
	for(int i = k; i <= n; ++i) res += dp[n][i];
	if(res >= 1 - e) return 1;
	return 0;
}

int main() {
	scanf("%d%d%lf", &n, &k, &e);
	e /= 1000;
	int cnt = 0;
	for(int i = 0; i <= n; ++i) {
		scanf("%d%d", &x[i], &y[i]);
		if(x[i] == x[0] && y[i] == y[0]) ++cnt;
	}
	if(cnt >= k + 1) {
		puts("0");
		return 0;
	}
	double l = 0.000001, r = 1e5;

	while(r - l > 1e-8) {
		double m = (l + r) / 2;
		if(check(m)) r = m;
		else l = m;
	}
	printf("%.12lf\n", l);
	return 0;
}


#include<bits/stdc++.h>
#define N 105
using namespace std;

inline void rd(int &x){
	x=0;char ch=0;int w=0;
	while(!isdigit(ch)) ch=getchar(),w|=ch=='-';
	while( isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	x=w?-x:x;
}

int n,k,c,X,Y;
int x[N],y[N];
double f[N][N],p[N],dis[N];

bool ok(double r,double ans=0){
	for(int i=1;i<=n;i++)
		p[i]= dis[i]<=r ? 1 : exp(1-dis[i]*dis[i]/r/r);
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++)
			f[i][j]=j?f[i-1][j-1]*p[i]+f[i-1][j]*(1-p[i]):f[i-1][j]*(1-p[i]);
	for(int i=0;i<k;i++)
		ans+=f[n][i];
	return ans*1000<=c;
}
signed main(){
	rd(n);rd(k);rd(c);rd(X);rd(Y);f[0][0]=1;
	for(int i=1;i<=n;i++)
		rd(x[i]),rd(y[i]),dis[i]=sqrt((X-x[i])*(X-x[i])+(Y-y[i])*(Y-y[i]));
	double l=0,r=4000;
	for(int i=1;i<=50;i++){
		double mid=(l+r)*0.5;
		ok(mid) ? r=mid : l=mid;
	} printf("%.9lf",l);
}


//lxrtxdy!
#include<cstring>
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#define maxn 2005
using namespace std;
int n;
int k, e;
double x0, y0;
double x[maxn], y[maxn];
double dp[maxn][maxn];
double buf[maxn];
bool eps(double a) {
	return fabs(a)<1e-8;
}
double dis(double a, double b) {
	return sqrt(a*a+b*b);
}
double pro(double D, double R) {
	if(D<=R) return 1.0;
	return exp(1.0-D*D/(R*R));
}
bool judge(double R) {
	memset(dp,0,sizeof(dp));
	dp[0][0] = 1.0;
	for(int i=1; i<=n; i++) {
		buf[i] = pro(dis(x0 - x[i], y0 - y[i]), R);
	}
	for(int i=1;i<=n;i++) {
		dp[i][0] = (1.0-buf[i])*dp[i-1][0];
		for(int j=1;j<=i;j++) {
			dp[i][j]=buf[i]*dp[i-1][j-1] + (1.0-buf[i])*dp[i-1][j];
		}
	}
	double res = 0;
	for(int i=0;i<k;i++) res += dp[n][i];
//	cout << res << endl;
	return (res<=e*1.0/(1000*1.0));
}
int main() {

	scanf("%d%d",&n,&k);
	scanf("%d",&e);
	scanf("%lf%lf",&x0,&y0);
	double l=0, r=0, ans=0;
	for(int i=1; i<=n; i++) {
		scanf("%lf%lf",&x[i],&y[i]);
		r=max(r,dis(x0 - x[i], y0 - y[i]));
	}
	while(!eps(r-l)) {
		double mid=(r+l)/2;
		if(judge(mid)) {
			ans = mid;
			r = mid;
		} else l = mid;
	}
	printf("%.10lf\n",ans);
}
 	  	 		   	   			    	  	   	//hellobig_tq
//orzlxr!


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <typename T> inline T pow2(T x) { return x * x; }
int main() {
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    int n, k, p, x0, y0;
    cin >> n >> k >> p;
    double P =1- p / 1000.0, R = 0x7fffffffffffffff, m[101];
    cin >> x0 >> y0;
    for (int i = 0; i < n; i++) {
        int x1, y1;
        cin >> x1 >> y1;
        m[i] = sqrt((double)pow2(x0 - x1) + (double)pow2(y0 - y1));

    }
    sort(m, m + n);
    cout << setprecision(16) << sqrt(pow2(m[k - 1]) / (1 - log(P)));
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#define d double
using namespace std;
struct A{d x,y,dis;}a[110];
d p,X,Y,r;
int n,k;
bool cmp(A aa,A bb){return aa.dis<bb.dis;}
int main()
{
    cin>>n>>k>>p>>X>>Y;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].x>>a[i].y;
        a[i].dis=sqrt((a[i].x-X)*(a[i].x-X)+(a[i].y-Y)*(a[i].y-Y));
    }
    sort(a+1,a+n+1,cmp);
    r=sqrt((a[k].dis*a[k].dis)/(1-log(1-p/1000)));
    printf("%.14lf",r);
    return 0;
}


#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
#define d double
#define eps (1e-10)
using namespace std;
int n,k;
d p,X,Y,ans;
d a[110],f[110][110],c[110];
d cal(d D,d R)
{
    if(D<=R) return 1.0;
    else return exp(1.0-D*D/(R*R));
}
bool check(d mid)
{
    d sum=0;
    memset(f,0,sizeof(f));
    f[0][0]=1;
    for(int i=1;i<=n;i++)
    c[i]=1-cal(a[i],mid);
    for(int i=1;i<=n;i++)
    {
        f[i][0]=f[i-1][0]*c[i];
        for(int j=1;j<=i;j++)
        f[i][j]=f[i-1][j]*c[i]+f[i-1][j-1]*(1-c[i]);
    }
    for(int i=0;i<k;i++)
    sum+=f[n][i];
    return sum<=p/1000;
}
int main()
{
    d x,y,l=0,r=0,mid;
    cin>>n>>k>>p>>X>>Y;
    for(int i=1;i<=n;i++)
    {
        cin>>x>>y;
        a[i]=sqrt(pow(x-X,2)+pow(y-Y,2));
        r=max(r,a[i]);
    }
    while(l+eps<=r)
    {
        mid=(l+r)/2;
        if(check(mid)) ans=mid,r=mid;
        else l=mid;
    }
    printf("%.10lf",ans);
    return 0;
}


#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
#define fo1(a,b) for(int a=0;a<b;++a)
#define fo2(a,b) for(int a=1;a<=b;++a)
#define lowbit(a) (a&(-a))
#define fir(a) a->first
#define sec(a) a->second
const int inf=0x3f3f3f3f;
const int maxn=1e2+5;
const int mod=1e9+7;
const double eps=1e-6;
const double e=2.7182818284590452353602874713527;
int n,k,p;
double l,r,R,f[maxn][maxn],tp[maxn]; //失败的概率
struct node{
    double x,y;
}coor[maxn];
double coor_cal(double a,double b){
    return sqrt((a-coor[0].x)*(a-coor[0].x)+(b-coor[0].y)*(b-coor[0].y));
}
double exp(double a){
    return pow(e,a);
}
double cal(double D){
    if(D<=R)
        return 1.0;
    else
        return exp(1.0-D*D/(R*R));
}
bool check(double mid){
    mem(f,0);
    f[0][0]=1.0;
    R=mid;
    fo2(i,n)
    tp[i]=1.0-cal(coor_cal(coor[i].x,coor[i].y)); //爆炸失败
    fo2(i,n){
        f[i][0]=f[i-1][0]*tp[i]; //失败
        fo2(j,i){
            f[i][j]=f[i-1][j]*tp[i]+f[i-1][j-1]*(1.0-tp[i]); //失败 成功
        }
    }
    double sum=0.0;
    fo1(i,k)
    sum+=f[n][i];
    return sum<=p/1000.0;
}
int main()
{
    scanf("%d%d%d",&n,&k,&p);
    scanf("%lf%lf",&coor[0].x,&coor[0].y);
    fo2(i,n){
        scanf("%lf%lf",&coor[i].x,&coor[i].y);
        r=max(r,coor_cal(coor[i].x,coor[i].y));
    }
    double ans;
    while(l+eps<=r){
        double mid=(l+r)/2.0;
        if(check(mid))
        ans=mid,r=mid;
        else
        l=mid;
    }
    printf("%.12lf\n",ans);
    return 0;
}


#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
#define mem(a,b) memset(a,b,sizeof(a))
#define fo1(a,b) for(int a=0;a<b;++a)
#define fo2(a,b) for(int a=1;a<=b;++a)
#define lowbit(a) (a&(-a))
#define fir(a) a->first
#define sec(a) a->second
const int inf=0x3f3f3f3f;
const int maxn=1e2+5;
const int mod=1e9+7;
const double eps=1e-6;
const double e=2.7182818284590452353602874713527;
int n,k,p;
double l,r,R,f[maxn][maxn],tp[maxn];
struct node{
    double x,y;
}coor[maxn];
double coor_cal(double a,double b){
    return sqrt((a-coor[0].x)*(a-coor[0].x)+(b-coor[0].y)*(b-coor[0].y));
}
double exp(double a){
    return pow(e,a);
}
double cal(double D){
    if(D<=R)
        return 1.0;
    else
        return exp(1.0-D*D/(R*R));
}
bool check(double mid){
    mem(f,0);
    f[0][0]=1.0;
    R=mid;
    fo2(i,n)
    tp[i]=1.0-cal(coor_cal(coor[i].x,coor[i].y));
    fo2(i,n){
        f[i][0]=f[i-1][0]*tp[i];
        fo2(j,i){
            f[i][j]=f[i-1][j]*tp[i]+f[i-1][j-1]*(1.0-tp[i]);
        }
    }
    double sum=0.0;
    fo1(i,k)
    sum+=f[n][i];
    return sum<=p/1000.0;
}
int main()
{
    scanf("%d%d%d",&n,&k,&p);
    scanf("%lf%lf",&coor[0].x,&coor[0].y);
    fo2(i,n){
        scanf("%lf%lf",&coor[i].x,&coor[i].y);
        r=max(r,coor_cal(coor[i].x,coor[i].y));
    }
    double ans;
    while(l+eps<=r){
        double mid=(l+r)/2.0;
        if(check(mid))
        ans=mid,r=mid;
        else
        l=mid;
    }
    printf("%.12lf\n",ans);
    return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

typedef long double ld;

ld dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

ld P(ld R, ld D) {
    if(D <= R) return 1;
    return exp(1 - (D*D) / (R*R));
}

ld calc(ld r, int k, vector<int> &x, vector<int> &y) {
    int n = x.size() - 1;
    ld dp[n+1][n+1];
    for(int i=0; i <= n; ++i) {
        for(int j=0; j <= n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i <= n; ++i) {
        for(int j=0; j <= i; ++j) {
            dp[i][j] =
            dp[i-1][j] * (1 - P(r, dist(x[0], y[0], x[i], y[i]))) +
            (j > 0 ? dp[i-1][j-1] : 1) * P(r, dist(x[0], y[0], x[i], y[i]));
        }
    }
    ld result = 0;
    for(int i=k; i <= n; ++i) {
        result += dp[n][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	ld eps;
	cin >> n >> k >> eps;
	vector<int> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e4;
	const ld EPS = 1e-13;
	while(r - l > EPS) {
	    ld mid = (l + r) / 2;
	    ld prob = calc(mid, k, x, y);
	    if(prob > 1 - eps / 1000) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(8);
	cout << r << endl;
	return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

double P(double R, double D) {
    double e = 2.71828182845904;
    double EPS = 1e-7;
    if(D < R - EPS) return 1;
    return exp(1 - D / (R*R));
}

double calc(double r, int k, vector<double> &x, vector<double> &y) {
    int n = x.size();
    double dp[n][n];
    for(int i=0; i < n; ++i) {
        for(int j=0; j < n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i < n; ++i) {
        double xi = (x[i] - x[0]);
        double yi = (y[i] - y[0]);
        double di = xi*xi + yi*yi;
        double pi = P(r, di);
        for(int j=0; j <= i; ++j) {
            dp[i][j] = dp[i-1][j] * (1 - pi) + (j > 0 ? dp[i-1][j-1] : 0) * pi;
        }
    }
    double result = 0;
    for(int i=k; i < n; ++i) {
        result += dp[n-1][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	double eps;
	cin >> n >> k >> eps;
	vector<double> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	double l = 0, r = 1e5;
	double EPS = 1e-7;
	for(int i=0; i < 200; ++i) {
	    double mid = (l + r) / 2;
	    double fail_prob = 1 - calc(mid, k, x, y);
	    if(fail_prob < (eps / 1000) - EPS) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(10);
	cout << r << endl;
	return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

typedef long double ld;

ld dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

ld P(ld R, ld D) {
    if(D <= R) return 1;
    return exp(1 - (D*D) / (R*R));
}

ld calc(ld r, int k, vector<int> &x, vector<int> &y) {
    int n = x.size() - 1;
    ld dp[n+1][n+1];
    for(int i=0; i <= n; ++i) {
        for(int j=0; j <= n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i <= n; ++i) {
        for(int j=0; j <= i; ++j) {
            dp[i][j] =
            dp[i-1][j] * (1 - P(r, dist(x[0], y[0], x[i], y[i]))) +
            (j > 0 ? dp[i-1][j-1] : 1) * P(r, dist(x[0], y[0], x[i], y[i]));
        }
    }
    ld result = 0;
    for(int i=k; i <= n; ++i) {
        result += dp[n][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	ld eps;
	cin >> n >> k >> eps;
	vector<int> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e4;
	const ld EPS = 1e-6;
	while(r - l > EPS) {
	    ld mid = (l + r) / 2;
	    ld prob = calc(mid, k, x, y);
	    if(prob > 1 - eps / 1000) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(8);
	cout << r << endl;
	return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

typedef long double ld;

ld dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

ld P(ld R, ld D) {
    if(D <= R) return 1;
    return exp(1 - (D*D) / (R*R));
}

ld calc(ld r, int k, vector<int> &x, vector<int> &y) {
    int n = x.size();
    ld dp[n+1][n+1];
    for(int i=0; i <= n; ++i) {
        for(int j=0; j <= n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i <= n; ++i) {
        for(int j=0; j <= i; ++j) {
            dp[i][j] =
            dp[i-1][j] * (1 - P(r, dist(x[0], y[0], x[i], y[i]))) +
            (j > 0 ? dp[i-1][j-1] : 1) * P(r, dist(x[0], y[0], x[i], y[i]));
        }
    }
    ld result = 0;
    for(int i=k; i <= n; ++i) {
        result += dp[n][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	ld eps;
	cin >> n >> k >> eps;
	vector<int> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e4;
	const ld EPS = 1e-13;
	while(r - l > EPS) {
	    ld mid = (l + r) / 2;
	    ld prob = calc(mid, k, x, y);
	    if(prob > 1 - eps / 1000) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(8);
	cout << r << endl;
	return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

typedef long double ld;

ld dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

ld P(ld R, ld D) {
    if(D <= R) return 1;
    return exp(1 - (D*D) / (R*R));
}

ld calc(ld r, int k, vector<int> &x, vector<int> &y) {
    int n = x.size() - 1;
    ld dp[n+1][n+1];
    for(int i=0; i <= n; ++i) {
        for(int j=0; j <= n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i <= n; ++i) {
        for(int j=0; j <= i; ++j) {
            dp[i][j] =
            dp[i-1][j] * (1 - P(r, dist(x[0], y[0], x[i], y[i]))) +
            (j > 0 ? dp[i-1][j-1] : 0) * P(r, dist(x[0], y[0], x[i], y[i]));
        }
    }
    ld result = 0;
    for(int i=k; i <= n; ++i) {
        result += dp[n][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	ld eps;
	cin >> n >> k >> eps;
	vector<int> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e4;
	const ld EPS = 1e-6;
	while(r - l > EPS) {
	    ld mid = (l + r) / 2;
	    ld prob = calc(mid, k, x, y);
	    if(prob > 1 - eps / 1000) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(8);
	cout << r << endl;
	return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

typedef long double ld;

ld dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

ld P(ld R, ld D) {
    if(D <= R) return 1;
    return exp(1 - (D*D) / (R*R));
}

ld calc(ld r, int k, vector<int> &x, vector<int> &y) {
    int n = x.size();
    ld dp[n][n];
    for(int i=0; i < n; ++i) {
        for(int j=0; j < n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i < n; ++i) {
        for(int j=0; j <= i; ++j) {
            dp[i][j] =
            dp[i-1][j] * (1 - P(r, dist(x[0], y[0], x[i], y[i]))) +
            (j > 0 ? dp[i-1][j-1] : 1) * P(r, dist(x[0], y[0], x[i], y[i]));
        }
    }
    ld result = 0;
    for(int i=k; i < n; ++i) {
        result += dp[n-1][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	ld eps;
	cin >> n >> k >> eps;
	vector<int> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e4;
	const ld EPS = 1e-8;
	while(r - l > EPS) {
	    ld mid = (l + r) / 2;
	    ld prob = calc(mid, k, x, y);
	    if(prob > 1 - eps / 1000) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(8);
	cout << r << endl;
	return 0;
}


#ifdef PRAGMA_COMMENT_LINKER
#pragma comment(linker, "/STACK:1999999999")
#endif

#define  _CRT_SECURE_NO_WARNINGS
//#define  NDEBUG

#pragma warning(error : 4700)
#pragma warning(error : 4715)
#pragma warning(error : 4716)

#include <algorithm>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <functional>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define all(v)                  v.begin(), v.end()
#define db(x)                   cerr << #x << " = " << (x) << "\n"
#define fend(x)                 ((x) & ((x)+1)) - 1
#define fenu(x)                 (x) | ((x)+1)
#define forn(i, n)              for (int i = 0; i < (int)n; ++i)
#define ft                      first
#define len(s)                  s.length()
#define maxV(type)              std::numeric_limits<type>::max()
#define minV(type)              std::numeric_limits<type>::min()
#define mp                      std::make_pair
#define popb                    pop_back
#define popf                    pop_front
#define popcnt                  __popcnt
#define popcnt64                __popcnt64
#define pushb                   push_back
#define pushf                   push_front
#define sc                      second

#ifdef _WIN32
#define LL "%I64d"
#else
#define LL "%lld"
#endif

typedef long long               ll;
typedef unsigned long long      ull;

const   long long               MILLER_RABIN = 3215031751;
const   long double             PI = 3.14159265358979323846;

inline int lg2(ll n) { int h = 0; while ((1ll << h) < n) ++h; return h; }

struct config_io { config_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } } cnf_io;
struct config_rand { config_rand() { srand(chrono::duration_cast<chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count()); } } cnf_rand;

namespace std {
	template <>
	struct hash < pair<int, int> > {
		size_t operator()(const pair<int, int>& x) const {
			return (x.first * 31 + x.second) % ((int)1e9 + 7);
		}
	};
}

typedef long double ld;

ld dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

ld P(ld R, ld D) {
    if(D <= R) return 1;
    return exp(1 - (D*D) / (R*R));
}

ld calc(ld r, int k, vector<int> &x, vector<int> &y) {
    int n = x.size();
    ld dp[n][n];
    for(int i=0; i < n; ++i) {
        for(int j=0; j < n; ++j) {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i=1; i < n; ++i) {
        for(int j=0; j <= i; ++j) {
            dp[i][j] =
            dp[i-1][j] * (1 - P(r, dist(x[0], y[0], x[i], y[i]))) +
            (j > 0 ? dp[i-1][j-1] : 1) * P(r, dist(x[0], y[0], x[i], y[i]));
        }
    }
    ld result = 0;
    for(int i=k; i < n; ++i) {
        result += dp[n-1][i];
    }
    return result;
}

int main() {
#define TASK "home"
	//freopen(TASK".in", "r", stdin); freopen(TASK".out", "w", stdout);
	int n, k;
	ld eps;
	cin >> n >> k >> eps;
	vector<int> x(n+1), y(n+1);
	for(int i=0; i <= n; ++i) {
	    cin >> x[i] >> y[i];
	}
	ld l = 0, r = 1e4;
	const ld EPS = 1e-18;
	while(r - l > EPS) {
	    ld mid = (l + r) / 2;
	    ld prob = calc(mid, k, x, y);
	    if(prob > 1 - eps / 1000) {
	        r = mid;
	    }
	    else {
	        l = mid;
	    }
	}
	cout << fixed << setprecision(8);
	cout << r << endl;
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()
#define f(i,a,b) for(int i = (a); i <= (b); i++)
#define fd(i,a,b) for(int i = (a); i >= (b); i--)
#define mp make_pair
#define faster_io() ios_base::sync_with_stdio(false)
#define pb push_back
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
#define vii vector<pair<int,int>>

const int INF = 1000000002;
const ll INFLL = 100000000000000000ll;
const ll MOD = 1000000007;

// ----------------------------------------------------------------------------------------------------------

const double e = 2.7182818284590452353602874713527;
const double eps = .00000001;
double DP[105][105], P[105], X[105], Y[105], Need;
int N, K;

bool ok(double r)
{
    f(i,1,N)
    {
        double dx = abs(X[i] - X[0]);
        double dy = abs(Y[i] - Y[0]);
        double dist = sqrt(dx*dx + dy*dy);
        P[i] = dist <= r+eps ? 1 : pow(e, 1.0 - (dist*dist)/(r*r));
    }
    DP[0][0] = 1;
    f(i,1,N) f(j,0,i)
    {
        DP[i][j] = 0;
        if(j>0) DP[i][j] += DP[i-1][j-1] * P[i];
        DP[i][j] += DP[i-1][j] * (1.0 - P[i]);
    }

    double p = 0;
    f(j,K,N) p += DP[N][j];
    return p >= Need+eps;
}

int main()
{
    cin >> N >> K >> Need;
    Need /= 1000;
    Need = 1 - Need;
    f(i,0,N) cin >> X[i] >> Y[i];
    double a = 0, b = 10000;
    f(x,1,100)
    {
        double p = (a+b) / 2;
        if(ok(p)) b = p;
        else a = p;
    }
    cout << setprecision(15) << fixed << a;
}


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef double DB;
const DB eps=1e-6;
DB p;
DB x[105],y[105],x0,yy,dp[105][105];
int n,k;
DB dis(int pos)
{
	return sqrt((x[pos]-x0)*(x[pos]-x0)+(y[pos]-yy)*(y[pos]-yy));
}
DB get(DB r,int pos)
{
	if (r>=dis(pos)) return 1.0;
	else return exp(1.0-dis(pos)*dis(pos)/(r*r));
}
bool judge(DB r)
{
	memset(dp,0,sizeof (dp));
	dp[0][0]=1.0;
	for (int i=1;i<=n;++i)
	{
		dp[i][0]=dp[i-1][0]*(1.0-get(r,i));
	    for (int j=1;j<=i;++j)
	      dp[i][j]=dp[i-1][j]*(1.0-get(r,i))+dp[i-1][j-1]*get(r,i);
	}
	DB ans=0;
	for (int i=0;i<k;++i)
	  ans+=dp[n][i];
	return ans<=p/1000.0;
}
int main()
{
	scanf("%d%d%lf",&n,&k,&p);
	scanf("%lf%lf",&x0,&yy);
	DB l=0.0,r=0.0;
	for (int i=1;i<=n;++i)
	{
		scanf("%lf%lf",&x[i],&y[i]);
		r=max(r,dis(i));
	}
	while(l<=r-eps)
	{
		DB mid=(l+r)/2;
		if (judge(mid)) r=mid;
		else l=mid;
	}
	printf("%.10lf",(l+r)/2);
	return 0;
}


#include<bits/stdc++.h>
#define eps 1e-10
#define ld long double
using namespace std;

ld dp[110][110] , point[110][2] , dis[110] , x00 , y00 , delta;
int N , K;

inline ld calc(ld x1 , ld y1 , ld x2 , ld y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

bool check(ld mid){
    memset(dp , 0 , sizeof(dp));
    dp[0][0] = 1;
	for(int i = 1 ; i <= N ; ++i){
		ld p;
		if(dis[i] > mid){
			p = exp(1 - dis[i] * dis[i] / mid / mid);
			dp[i][0] = dp[i - 1][0] * (1 - p);
		}
		else
			p = 1;
		for(int j = 1 ; j <= i ; ++j)
			dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * (1 - p);
	}
	ld sum = 0;
	for(int i = K ; i <= N ; ++i)
		sum += dp[N][i];
	return sum * 1000 + delta > 1000;
}

int main(){
	dp[0][0] = 1;
	cin >> N >> K >> delta >> x00 >> y00;
	for(int i = 1 ; i <= N ; ++i){
		cin >> point[i][0] >> point[i][1];
		dis[i] = calc(point[i][0] , point[i][1] , x00 , y00);
	}
	ld L = 0 , R = 4e3;
	while(L + eps < R){
		ld mid = (L + R) / 2;
		check(mid) ? R = mid : L = mid;
	}
	cout << fixed << setprecision(8) << L;
	return 0;
}


#include<bits/stdc++.h>
#define eps 1e-10
#define ld long double
using namespace std;

ld dp[110][110] , point[110][2] , dis[110] , x00 , y00 , delta;
int N , K;

inline ld calc(ld x1 , ld y1 , ld x2 , ld y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

bool check(ld mid){
	for(int i = 1 ; i <= N ; ++i){
		ld p;
		if(dis[i] > mid){
			p = exp(1 - dis[i] * dis[i] / mid / mid);
			dp[i][0] = dp[i - 1][0] * (1 - p);
		}
		else
			p = 1;
		for(int j = 1 ; j <= i ; ++j)
			dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * (1 - p);
	}
	ld sum = 0;
	for(int i = K ; i <= N ; ++i)
		sum += dp[N][i];
	return sum + eps > 1 - delta / 1000;
}

int main(){
	dp[0][0] = 1;
	cin >> N >> K >> delta >> x00 >> y00;
	for(int i = 1 ; i <= N ; ++i){
		cin >> point[i][0] >> point[i][1];
		dis[i] = calc(point[i][0] , point[i][1] , x00 , y00);
	}
	ld L = 0 , R = 4e3;
	while(L + eps < R){
		ld mid = (L + R) / 2;
		check(mid) ? R = mid : L = mid;
	}
	cout << fixed << setprecision(8) << L;
	return 0;
}


#include<bits/stdc++.h>
#define eps 1e-10
#define ld long double
using namespace std;

ld dp[110][110] , point[110][2] , dis[110] , x00 , y00 , delta;
int N , K;

inline ld calc(ld x1 , ld y1 , ld x2 , ld y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

bool check(ld mid){
	for(int i = 1 ; i <= N ; ++i){
		ld p;
		if(dis[i] > mid){
			p = exp(1 - dis[i] * dis[i] / mid / mid);
			dp[i][0] = dp[i - 1][0] * (1 - p);
		}
		else
			p = 1;
		for(int j = 1 ; j <= i ; ++j)
			dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * (1 - p);
	}
	ld sum = 0;
	for(int i = K ; i <= N ; ++i)
		sum += dp[N][i];
	return sum + eps > 1 - delta / 1000;
}

int main(){
	dp[0][0] = 1;
	cin >> N >> K >> delta >> x00 >> y00;
	for(int i = 1 ; i <= N ; ++i){
		cin >> point[i][0] >> point[i][1];
		dis[i] = calc(point[i][0] , point[i][1] , x00 , y00);
	}
	ld L = 0 , R = 2e3;
	while(L + eps < R){
		ld mid = (L + R) / 2;
		check(mid) ? R = mid : L = mid;
	}
	printf("%.8Lf" , L);
	return 0;
}


#include<bits/stdc++.h>
#define eps 1e-10
#define ld long double
using namespace std;

ld dp[110][110] , point[110][2] , dis[110] , x00 , y00 , delta;
int N , K;

inline ld calc(ld x1 , ld y1 , ld x2 , ld y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

bool check(ld mid){
	for(int i = 1 ; i <= N ; ++i){
		ld p;
		if(dis[i] > mid){
			p = exp(1 - dis[i] * dis[i] / mid / mid);
			dp[i][0] = dp[i - 1][0] * (1 - p);
		}
		else
			p = 1;
		for(int j = 1 ; j <= i ; ++j)
			dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * (1 - p);
	}
	ld sum = 0;
	for(int i = K ; i <= N ; ++i)
		sum += dp[N][i];
	return sum + eps > 1 - delta / 1000;
}

int main(){
	dp[0][0] = 1;
	cin >> N >> K >> delta >> x00 >> y00;
	for(int i = 1 ; i <= N ; ++i){
		cin >> point[i][0] >> point[i][1];
		dis[i] = calc(point[i][0] , point[i][1] , x00 , y00);
	}
	ld L = 0 , R = 2e3;
	while(L + eps < R){
		ld mid = (L + R) / 2;
		check(mid) ? R = mid : L = mid;
	}
	cout << fixed << setprecision(8) << L;
	return 0;
}


#include<bits/stdc++.h>
//This code is written by Itst
#define eps 1e-10
#define ld long double
using namespace std;

ld dp[110][110] , point[110][2] , dis[110] , x00 , y00 , delta;
int N , K;

inline ld calc(ld x1 , ld y1 , ld x2 , ld y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

bool check(ld mid){
    memset(dp , 0 , sizeof(dp));
    dp[0][0] = 1;
	for(int i = 1 ; i <= N ; ++i){
		ld p;
		if(dis[i] > mid){
			p = exp(1 - dis[i] * dis[i] / mid / mid);
			dp[i][0] = dp[i - 1][0] * (1 - p);
		}
		else
			p = 1;
		for(int j = 1 ; j <= i ; ++j)
			dp[i][j] = dp[i - 1][j - 1] * p + dp[i - 1][j] * (1 - p);
	}
	ld sum = 0;
	for(int i = K ; i <= N ; ++i)
		sum += dp[N][i];
	return sum * 1000 + delta > 1000;
}

int main(){
	dp[0][0] = 1;
	cin >> N >> K >> delta >> x00 >> y00;
	for(int i = 1 ; i <= N ; ++i){
		cin >> point[i][0] >> point[i][1];
		dis[i] = calc(point[i][0] , point[i][1] , x00 , y00);
	}
	ld L = 0 , R = 4e3;
	while(L + eps < R){
		ld mid = (L + R) / 2;
		check(mid) ? R = mid : L = mid;
	}
	cout << fixed << setprecision(8) << L;
	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;

const int MAX_N = 111;
const int GOD = 666 / 6;
const double e = 2.7182818284590452353602874713527;

int n, k;
double p;
int x[MAX_N], y[MAX_N], a, b;
double d[MAX_N], dp[MAX_N][MAX_N];

double sqr(double x)
{
	return x * x;
}

double dis(int x, int y)
{
	return sqrt(sqr(x - a) + sqr(y - b));
}

double f(double x)
{
	return pow(e, x);
}

void reset()
{
	for (int i = 0; i <= n; ++i)
		for (int j = 0; j <= n; ++j)
			dp[i][j] = 0.;
}

int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.precision(6);
	cout << fixed;
	cin >> n;
	cin >> k >> p;
	p /= 1000.;
	p = 1. - p;
	cin >> a >> b;
	for (int i = 1; i <= n; ++i)
	{
		cin >> x[i] >> y[i];
		d[i] = dis(x[i], y[i]);
	}
	double lo = 0., hi = 1e18;
	for (int i = 0; i < GOD; ++i)
	{
		reset();
		double mid = (lo + hi) / 2.;
		dp[0][0] = 1.;
		for (int i = 1; i <= n; ++i)
		{
			double prob;
			if (d[i] <= mid)
				prob = 1.;
			else
				prob = f(1. - d[i] * d[i] / (mid * mid));
			dp[i][0] = 1.;
			for (int j = 1; j <= i; ++j)
				dp[i][j] = prob * dp[i - 1][j - 1] + (1. - prob) * dp[i - 1][j];
		}
		if (dp[n][k] >= p)
			hi = mid;
		else
			lo = mid;
	}
	cout << lo << '\n';
	return 0;
}


#include<cstring>
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#define maxn 2005
using namespace std;
int n;
int k, e;
double x0, y0;
double x[maxn], y[maxn];
double dp[maxn][maxn];
double buf[maxn];
bool eps(double a) {
	return fabs(a)<1e-8;
}
double dis(double a, double b) {
	return sqrt(a*a+b*b);
}
double pro(double D, double R) {
	if(D<=R) return 1.0;
	return exp(1.0-D*D/(R*R));
}
bool judge(double R) {
	memset(dp,0,sizeof(dp));
	dp[0][0] = 1.0;
	for(int i=1; i<=n; i++) {
		buf[i] = pro(dis(x0 - x[i], y0 - y[i]), R);
	}
	for(int i=1;i<=n;i++) {
		dp[i][0] = (1.0-buf[i])*dp[i-1][0];
		for(int j=1;j<=i;j++) {
			dp[i][j]=buf[i]*dp[i-1][j-1] + (1.0-buf[i])*dp[i-1][j];
		}
	}
	double res = 0;
	for(int i=0;i<k;i++) res += dp[n][i];
//	cout << res << endl;
	return (res<=e*1.0/(1000*1.0));
}
int main() {

	scanf("%d%d",&n,&k);
	scanf("%d",&e);
	scanf("%lf%lf",&x0,&y0);
	double l=0, r=0, ans=0;
	for(int i=1; i<=n; i++) {
		scanf("%lf%lf",&x[i],&y[i]);
		r=max(r,dis(x0 - x[i], y0 - y[i]));
	}
	while(!eps(r-l)) {
		double mid=(r+l)/2;
		if(judge(mid)) {
			ans = mid;
			r = mid;
		} else l = mid;
	}
	printf("%.10lf\n",ans);
}
 	  	 		   	   			    	  	   	//hellobig_tq


#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define sqr(x) ((x)*(x))

typedef long double Double;
const Double E = 2.7182818284590452353602874713527;
const Double eps = 1e-10;
const int maxn = 110;

int n,k,e;
Double x,y;
Double p[maxn];
Double dp[maxn][maxn];
Double dis[maxn];

Double calc(int j, Double r){
    if(dis[j] < r*r + eps) return 1.0;
    return exp(1 - dis[j]/(r*r));
}

bool check(Double r){
    for(int i=1;i<=n;i++){
        p[i] = calc(i,r);
    }
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1000;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
        }
    }
    Double sum = 0.0;
    for(int i=0;i<k;i++) sum += dp[n][i];
    return  sum <= e;
}

int main(){
    scanf("%d%d%d",&n,&k,&e);
    cin >> x >> y;
    Double t1,t2;
    for(int i=1;i<=n;i++) {
        cin >> t1 >> t2;
        dis[i] = sqr(t1-x) + sqr(t2-x);
    }
    Double l=0.0, r = 10000.0;
    for(int i=0;i<50;i++){
        Double m = (l+r)*0.5;
        if(check(m)) r = m;
        else l = m;
    }
    cout << fixed << setprecision(10) << r << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define sqr(x) ((x)*(x))

typedef long double Double;
const Double eps = 1e-10;
const int maxn = 110;

int n,k,e;
Double x,y;
Double p[maxn];
Double dp[maxn][maxn];
Double dis[maxn];

Double calc(int j, Double r){
    if(dis[j] < r*r + eps) return 1.0;
    return exp(1 - dis[j]/(r*r));
}

bool check(Double r){
    for(int i=1;i<=n;i++){
        p[i] = calc(i,r);
    }
    memset(dp,0,sizeof(dp));
    dp[0][0] = 1000;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            dp[i][j] = dp[i-1][j]*(1-p[i]) + dp[i-1][j-1]*p[i];
        }
    }
    Double sum = 0;
    for(int i=0;i<k;i++) sum += dp[n][i];
    return  sum > e;
}

int main(){
    scanf("%d%d%d",&n,&k,&e);
    cin >> x >> y;
    Double t1,t2;
    for(int i=1;i<=n;i++) {
        cin >> t1 >> t2;
        dis[i] = sqr(t1-x) + sqr(t2-y);
    }
    Double l=0.0, r = 10000.0;
    for(int i=0;i<50;i++){
        Double m = (l+r)*0.5;
        if(check(m)) l = m;
        else r = m;
    }
    cout << fixed << setprecision(10) << r << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
double l, r, mid;
int n, k, p, a, b, x[210], y[210];
double d[210][210];
inline int read() {
    char ch; bool f = false; int res = 0;
    while (((ch = getchar()) < '0' || ch > '9') && ch != '-');
    if (ch == '-') f = true; else res = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9') res = (res << 3) + (res << 1) + ch - '0';
    return f? ~res + 1 : res;
}
int main() {
	n = read(), k = read(), p = read(), a = read(), b = read();
	for (int i = 0; i < n; ++ i)
		x[i] = read(), y[i] = read();
	r = 9999;
	for (int m = 0; m < 60; m ++) {
		mid = (l + r) / 2;
		d[0][0] = 1;
		for (int i = 0; i < n; i ++) {
			double z = hypot(x[i] - a, y[i] - b);
			double t;
			if (z <= mid)
				t = 1;
			else
				t = exp(1 - z * z / mid / mid);
			for (int j = 0; j <= i + 1; j ++)
				d[i + 1][j] = (j ? d[i][j - 1] * t : 0 + d[i][j] * (1 - t));
		}
		double s = 0;
		for (int i = k; i <= n; ++ i)
			s += d[n][i];
		if (s * 1000 < 1000 - p)
			l = mid;
		else
			r = mid;
	}
	printf("%.9f", r);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
double l, r, mid;
int n, k, p, a, b, x[210], y[210];
double d[210][210];
inline int read() {
    char ch; bool f = false; int res = 0;
    while (((ch = getchar()) < '0' || ch > '9') && ch != '-');
    if (ch == '-') f = true; else res = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9') res = (res << 3) + (res << 1) + ch - '0';
    return f? ~res + 1 : res;
}
int main() {
	n = read(), k = read(), p = read(), a = read(), b = read();
	for (int i = 0; i < n; ++ i)
		x[i] = read(), y[i] = read();
	r = 9999;
	for (int m = 0; m < 60; m ++) {
		mid = (l + r) / 2;
		d[0][0] = 1;
		for (int i = 0; i < n; i ++) {
			double z = hypot(x[i] - a, y[i] - b);
			double t;
			if (z <= mid)
				t = 1;
			else
				t = exp(1 - z * z / mid / mid);
			for (int j = 0; j <= i + 1; j ++)
				d[i + 1][j] = (j ? d[i][j - 1] * t : 0) + d[i][j] * (1 - t);
		}
		double s = 0;
		for (int i = k; i <= n; ++ i)
			s += d[n][i];
		if (s * 1000 < 1000 - p)
			l = mid;
		else
			r = mid;
	}
	printf("%.9f", r);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("draft.inp","r",stdin)
#define OUTPUT freopen("draft.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;

const int inf=1e9;
const int MOD=1e9+7;
const int N=1e2+10;
const double eps=1e-9;

double f[N];
int n,m,per,rx,ry,x,y,d[N];
int sqr(int x){
    return x*x;
}
int dist(ii a,ii b){
    return sqr(a.X-b.X)+sqr(a.Y-b.Y);
}
double check(double M){
    f[0]=1;
    FOR(i,1,n) f[i]=.0;
    FOR(i,1,n){
        double prob=(M*M>=d[i])?1.0:((abs(M)<eps)?0:exp(1-(d[i]+.0)/(M*M)));
        FORD(j,i,1) f[j]=prob*f[j-1]+(1.0-prob)*f[j];
        f[0]*=(1-prob);
    }
//    FOR(i,0,n) printf("%.10f ",f[i]);ENDL;
    FOR(i,1,m) f[i]+=f[i-1];
    //printf("%.10f\")
    return f[m]*1000<=per;
}
int main(){
//    INPUT;OUTPUT;
    scanf("%d%d%d%d%d",&n,&m,&per,&rx,&ry);
    m--;
    FOR(i,1,n){
        scanf("%d%d",&x,&y);
        d[i]=dist(ii(x,y),ii(rx,ry));
    }
    double L=.0,R=1e5;
    FOR(i,1,100){
        double M=(L+R)/2;
//        printf("%.10f %.10f %.10f\n",L,R,M);
        if (check(M)) R=M;
        else L=M;
    }
    printf("%.10f\n",L);
}


#include <bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define INPUT freopen("draft.inp","r",stdin)
#define OUTPUT freopen("draft.out","w",stdout)
#define FOR(i,l,r) for(auto i=l;i<=r;i++)
#define REP(i,l,r) for(auto i=l;i<r;i++)
#define FORD(i,l,r) for(auto i=l;i>=r;i--)
#define REPD(i,l,r) for(auto i=l;i>r;i--)
#define ENDL printf("\n")
#define debug 1

typedef long long ll;
typedef pair<int,int> ii;

const int inf=1e9;
const int MOD=1e9+7;
const int N=1e2+10;
const double eps=1e-9;

double f[N];
int n,m,per,rx,ry,x,y,d[N];
int sqr(int x){
    return x*x;
}
int dist(ii a,ii b){
    return sqr(a.X-b.X)+sqr(a.Y-b.Y);
}
double check(double M){
    f[0]=1;
    FOR(i,1,n) f[i]=.0;
    FOR(i,1,n){
        double prob=(M*M>=d[i])?1.0:((abs(M)<eps)?0:exp(1-(d[i]+.0)/(M*M)));
        FORD(j,i,1) f[j]=prob*f[j-1]+(1.0-prob)*f[j];
        f[0]*=(1-prob);
    }
//    FOR(i,0,n) printf("%.10f ",f[i]);ENDL;
    FOR(i,1,m) f[i]+=f[i-1];
    //printf("%.10f\")
    return f[m]*1000<=per;
}
int main(){
//    INPUT;
    scanf("%d%d%d%d%d",&n,&m,&per,&rx,&ry);
    m=n-m;
    FOR(i,1,n){
        scanf("%d%d",&x,&y);
        d[i]=dist(ii(x,y),ii(rx,ry));
    }
    double L=.0,R=1e5;
    FOR(i,1,100){
        double M=(L+R)/2;
//        printf("%.10f %.10f %.10f\n",L,R,M);
        if (check(M)) R=M;
        else L=M;
    }
    printf("%.10f\n",L);
}


#include<iostream>
#include<stdio.h>
#include<memory.h>
#include<cmath>

using namespace std;

int x[110],
    y[110];

double dp[110][110];

int main() {
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    memset(dp, 0.0, sizeof(dp));

    int n = 0,
        k = 0,
        p  = 0,
        x0 = 0,
        y0 = 0;

    scanf("%d%d%d", &n, &k, &p);
    scanf("%d%d", &x0, &y0);
    for(int i = 0; i<n; ++i) {
        scanf("%d%d", &x[i], &y[i]);
    }

    double  l = 0,
            r = 10000.0;
    for(int t = 0; t<100; ++t) {
        double mid = (l+r)/2.0;
        dp[0][0] = 1.0;
        for(int i = 0; i<n; ++i) {
            double d = hypot(x[i]-x0, y[i]-y0);
            double q = 0.0;
            if(d<=mid) {
                q = 1.0;
            }
            else {
                q = exp(1-d*d/(mid*mid));
            }

            for(int j = 0; j<=i+1; ++j) {
                dp[i+1][j] = dp[i][j]*(1.0-q);
                if(j) {
                    dp[i+1][j] += dp[i][j-1]*q;
                }
            }
        }

        double ex = 0.0;
        for(int i = k; i<=n; ++i) {
            ex += dp[n][i];
        }

        if(ex*1000<1000-p) {
            l = mid;
        }
        else {
            r  = mid;
        }
    }

    printf("%.8lf", r);
    return 0;
}


import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        int[] arr = new int[256];
        String s = nextLine();
        for (int i = 0; i < s.length(); i++) {
            arr[s.charAt(i)]++;
        }
        long count = 0, local = 1;
        for (int i = 0; i < 256; i++) {
            local = arr[i] * arr[i];
            count += local;
        }
        System.out.println(count);
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws IOException {
        solve();
    }

}


import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        String s = nextLine();
        int count = 0;
        char[] arr = s.toCharArray();
        for (int i = 0; i < s.length(); i++) {
            for (int j = 0; j < s.length(); j++) {
                if(arr[i] == arr[j]) count++;
            }
        }
        System.out.println(count);
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws IOException {
        solve();
    }

}


import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        int[] arr = new int[256];
        String s = nextLine();
        for (int i = 0; i < s.length(); i++) {
            arr[s.charAt(i)]++;
        }
        int count = 0, local = 1;
        for (int i = 0; i < 256; i++) {
            local*= arr[i];
            count =+ local;
            local = 1;
        }
        System.out.println(count);
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws IOException {
        solve();
    }

}


import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        long[] arr = new long[256];
        String s = nextLine();
        for (int i = 0; i < s.length(); i++) {
            arr[s.charAt(i)]++;
        }
        long count = 0, local;
        for (int i = 0; i < 256; i++) {
            local = arr[i] * arr[i];
            count += local;
        }
        System.out.println(count);
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws IOException {
        solve();
    }

}


import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;

public class Main {
    public static FastIO file = new FastIO();

    private static void solve() {
        int[] arr = new int[256];
        String s = nextLine();
        for (int i = 0; i < s.length(); i++) {
            arr[s.charAt(i)]++;
        }
        int count = 0, local = 1;
        for (int i = 0; i < 256; i++) {
            local = arr[i] * arr[i];
            count += local;
        }
        System.out.println(count);
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;
        PrintWriter out;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws IOException {
        solve();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class choosingSymbolPairs1 {
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		String s=sc.next();
		int alpha[]=new int[26];
		int num[]=new int[10];
		for(int i=0;i<s.length();i++)
		{
			if(s.charAt(i)>='a' && s.charAt(i)<='z')
			{
				alpha[s.charAt(i)-'a']++;
			}

			else
			{
				num[s.charAt(i)-'0']++;
			}
		}
		long ans=0;
		for(int i=0;i<alpha.length;i++)
		{
			ans+=alpha[i]*alpha[i];
		}

		for(int i=0;i<num.length;i++)
		{
			ans+=num[i]*num[i];
		}

		System.out.println(ans);
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;

public class choosingSymbolPairs1 {
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		String s=sc.next();
		long alpha[]=new long[26];
		long num[]=new long[10];
		for(int i=0;i<s.length();i++)
		{
			if(s.charAt(i)>='a' && s.charAt(i)<='z')
			{
				alpha[s.charAt(i)-'a']++;
			}

			else
			{
				num[s.charAt(i)-'0']++;
			}
		}
		long ans=0;
		for(int i=0;i<alpha.length;i++)
		{
			ans+=alpha[i]*alpha[i];
		}

		for(int i=0;i<num.length;i++)
		{
			ans+=num[i]*num[i];
		}

		System.out.println(ans);
	}
}


/**
 * @author egaeus
 * @mail sebegaeusprogram@gmail.com
 * @veredict Not sended
 * @url <https://codeforces.com/problemset/problem/50/B>
 * @category ?
 * @date 14/06/2020
 **/

import java.io.*;
import java.util.*;

import static java.lang.Integer.*;
import static java.lang.Math.*;

public class CF50B {
    public static void main(String args[]) throws Throwable {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        for (String ln; (ln = in.readLine()) != null && !ln.equals(""); ) {
            TreeMap<Character, Long> map = new TreeMap<>();
            char[] a = ln.toCharArray();
            for (char A : a) {
                Long v = map.get(A);
                if (v == null)
                    v = 0L;
                v++;
                map.put(A, v);
            }
            long s = 0;
            for (long A : map.values())
                s += A * A;
            System.out.println(s);
        }
    }
}


import java.util.*;
// Thought ill get away with the O(n^2) solution
// This one is a bit optimized
// warm-up
public class ChoosingSymbolPairs {

	static void solve(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		int[] ch = new int[256];
		int len = s.length();
		long sum = 0; // Point to note
		for (char c: s.toCharArray()) {
			if (ch[(int)c]==0) sb.append(c);
			ch[(int)c]++;
		}
		for (char c: sb.toString().toCharArray()) sum+=(ch[(int)c]*ch[(int)c]);
		System.out.println(sum);
		sc.close();
	}

	public static void main(String args[]) {
		solve();
	}

}


import java.util.*;
// Thought ill get away with the O(n^2) solution
// This one is a bit optimized
// warm-up
public class ChoosingSymbolPairs {

	static void solve(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		int[] ch = new int[256];
		int len = s.length(), sum = 0;
		for (char c: s.toCharArray()) {
			if (ch[(int)c]==0) sb.append(c);
			ch[(int)c]++;
		}
		for (char c: sb.toString().toCharArray()) sum+=(ch[(int)c]*ch[(int)c]);
		System.out.println(sum);
		sc.close();
	}

	public static void main(String args[]) {
		solve();
	}

}


import java.util.*;
// warm-up for warm-up
public class ChoosingSymbolPairs {

	static void solve(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int len = s.length(), c = 0;
		for (int i=0; i<len; i++) {
			for (int j=0; j<len; j++) {
				if ((i==j)||(s.charAt(i)==s.charAt(j))) c++;
			}
		}
		System.out.println(c);
		sc.close();
	}

	public static void main(String args[]) {
		solve();
	}

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[200005];
ll sum=0,ans=0,anss,q;
ll f(ll x){
	x--;
	return (1+x)*x/2;
}
priority_queue<ll> b;

bool cmp(int x,int y){
	return x>y;
}
int main(){
    cin>>n>>m;
    for (int i = 0; i < n; ++i){
    	cin>>a[i];
    	sum+=a[i];
    }
    if(sum<m){
    	cout<<-1<<endl;
    	return 0;
    }
    sum=0;
    sort(a,a+n,cmp);
    anss=n;
    for (int i = 0; i < n; ++i){
    	sum+=a[i];
    	ans=i+1;
	    ll k=sum-m;
	    if(k<0)continue;
	    while(!b.empty())b.pop();
	    q=f(ans);
	    b.push(ans);
	    ans=1;
	    while(q>k){
	    	ll t=b.top();
	    	q-=f(t);
	    	q+=f(t/2);
	    	q+=f(t-t/2);
	    	b.pop();
	    	b.push(t/2);
	    	b.push(t-t/2);
	    	ans++;
	    }
	    anss=anss<ans?anss:ans;
    }
    cout<<anss<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[200005];
ll sum=0,ans=0,anss,q;
ll f(ll x){
	x--;
	return (1+x)*x/2;
}
priority_queue<ll> b;

bool cmp(int x,int y){
	return x>y;
}
int main(){
    cin>>n>>m;
    for (int i = 0; i < n; ++i){
    	cin>>a[i];
    	sum+=a[i];
    }
    if(sum<m){
    	cout<<-1<<endl;
    	return 0;
    }
    sum=0;
    sort(a,a+n,cmp);
    anss=n;
    for (int i = 0; i < n; ++i){
    	sum+=a[i];
    	ans=i+1;
	    ll k=sum-m;
	    if(k<0)continue;
	    b=priority_queue<ll>();
	    q=f(ans);
	    b.push(ans);
	    ans=1;
	    while(q>k){
	    	ll t=b.top();
	    	q-=f(t);
	    	q+=f(t/2);
	    	q+=f(t-t/2);
	    	b.pop();
	    	b.push(t/2);
	    	b.push(t-t/2);
	    	ans++;
	    }
	    anss=anss<ans?anss:ans;
    }
    cout<<anss<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[200005];
ll sum=0,ans=0,anss,q;
ll f(ll x){
	x--;
	return (1+x)*x/2;
}
priority_queue<ll> b;

bool cmp(int x,int y){
	return x>y;
}

void clear(priority_queue<ll>& b) {
    priority_queue<ll> empty;
    swap(empty, b);
}
int main(){
    cin>>n>>m;
    for (int i = 0; i < n; ++i){
    	cin>>a[i];
    	sum+=a[i];
    }
    if(sum<m){
    	cout<<-1<<endl;
    	return 0;
    }
    sum=0;
    sort(a,a+n,cmp);
    anss=n;
    for (int i = 0; i < n; ++i){
    	sum+=a[i];
    	ans=i+1;
	    ll k=sum-m;
	    if(k<0)continue;
	    b=priority_queue<ll>();
	    q=f(ans);
	    b.push(ans);
	    ans=1;
	    while(q>k){
	    	ll t=b.top();
	    	q-=f(t);
	    	q+=f(t/2);
	    	q+=f(t-t/2);
	    	b.pop();
	    	b.push(t/2);
	    	b.push(t-t/2);
	    	ans++;
	    }
	    anss=anss<ans?anss:ans;
    }
    cout<<anss<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[200005];
ll sum=0,ans=0,anss,q,k;
ll f(ll x){
	x--;
	return (1+x)*x/2;
}
priority_queue<ll> b;

bool cmp(int x,int y){
	return x>y;
}

void clear(priority_queue<ll>& b) {
    priority_queue<ll> empty;
    swap(empty, b);
}
int main(){
    cin>>n>>m;
    for (int i = 0; i < n; ++i){
    	cin>>a[i];
    	sum+=a[i];
    }
    if(sum<m){
    	cout<<-1<<endl;
    	return 0;
    }
    sum=0;
    sort(a,a+n,cmp);
    anss=n;
    for (int i = 0; i < n; ++i){
    	sum+=a[i];
    	ans=i+1;
	    k=sum-m;
	    if(k<0)continue;
	    clear(b);
	    q=f(ans);
	    b.push(ans);
	    ans=1;
	    while(q>k){
	    	ll t=b.top();
	    	q-=f(t);
	    	q+=f(t/2);
	    	q+=f(t-t/2);
	    	b.pop();
	    	b.push(t/2);
	    	b.push(t-t/2);
	    	ans++;
	    }
	    anss=anss<ans?anss:ans;
    }
    cout<<anss<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[200005];
ll sum=0,ans=0,anss=0,q,k;
ll f(ll x){
	x--;
	return (1+x)*x/2;
}
bool cmp(int x,int y){
	return x>y;
}
int main(){
    cin>>n>>m;
    for (int i = 0; i < n; ++i){
    	cin>>a[i];
    	sum+=a[i];
    	if(sum>=m&&!anss)anss=i+1;
    }
    if(sum<m){
    	cout<<-1<<endl;
    	return 0;
    }
    sum=0;
    sort(a,a+n,cmp);
    for (int i = 0; i < n; ++i){
    	sum+=a[i];
	    k=sum-m;
	    if(k<0)continue;
	    i++;
	    ll l=1,r=i;
	    while(1){
	    	//cout<<i<<' '<<l<<' '<<r<<' '<<anss<<endl;
	    	ll mid=(l+r)/2;
	    	if(f(i/mid)*mid+i%mid*(i/mid)>k){
	    		l=mid+1;
	    		continue;
	    	}
	    	else {
	    		if(mid==1||f(i/(mid-1))*(mid-1)+i%(mid-1)*(i/(mid-1))>k){
	    			anss=anss<mid?anss:mid;
	    			break;
	    		}
	    		else r=mid;
	    	}
	    	if(l>=r){
	    		anss=anss<mid?anss:mid;
	    			break;
	    	}
	    }
	    i--;
    }
    cout<<anss<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
int a[200005];
ll sum=0,ans=0,anss,q;
ll f(ll x){
	x--;
	return (1+x)*x/2;
}
priority_queue<ll> b;

bool cmp(int x,int y){
	return x>y;
}
int main(){
    cin>>n>>m;
    for (int i = 0; i < n; ++i){
    	cin>>a[i];
    	sum+=a[i];
    }
    if(sum<m){
    	cout<<-1<<endl;
    	return 0;
    }
    sum=0;
    sort(a,a+n,cmp);
    anss=n;
    for (int i = 0; i < n; ++i){
    	sum+=a[i];
    	ans=i+1;
	    ll k=sum-m;
	    if(k<0)continue;
	    q=f(ans);
	    b.push(ans);
	    ans=1;
	    while(q>k){
	    	ll t=b.top();
	    	q-=f(t);
	    	q+=f(t/2);
	    	q+=f(t-t/2);
	    	b.pop();
	    	b.push(t/2);
	    	b.push(t-t/2);
	    	ans++;
	    }
	    anss=anss<ans?anss:ans;
    }
    cout<<anss<<endl;
    return 0;
}


//                                oppai daisukiii $$
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define double long double
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define P push
#define vvi vector<vector<int> >
#define vi vector<int>
#define vpi vector< pair<int,int> >
#define sz(a) (int)a.size()
#define all(a)   a.begin() , a.end()
//#define for(i,q,n) for(int i=q ; i<n ; i++)
// inline void io(){
// // #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// // #endif
//  }

void solve() {
    int n , m ; cin >> n >> m ;
    int a[n] , cf[n] , sm = 0 ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;
    }
    sort(a,a+n,greater<int>() )  ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;   sm += a[i] ;        cf[i] = sm ;
    }
    int an = -1 ;
    for(int i0 = 1 ; i0 <= n ; i0 ++){
        int l = 1 , r = n ;
        int fl  = -1 , ct = 0 ;
        while(l<=r){// ct++;
            int mid = l + (r-l)/2  ;
            int k = (mid) / i0  ;
            int d = ((k-1)*k/2 )*i0  + (mid%i0)*k ;
            int v = cf[mid-1] - d ;
            if( v<=0 ){
                r = mid - 1;
            }
            else if(v>0 && v<m ){
                l = mid + 1 ;
            }
            else
                if( v>=m ){
                    r = mid-1 ;
                    fl = mid ;

            }
            // if(ct > n + 1 ){ break; }

        }
        if( fl != -1 ){
            an = i0 ; break ;
        }

    }
    cout << an << endl;
}

signed main () {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    // io();
    int t1 = 1 ;
    //  cin >> t1 ;
//    cout << fixed << setprecision(8);
    while(t1--){
        solve( ) ;
    }
}


//                                oppai daisukiii $$
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define double long double
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define P push
#define vvi vector<vector<int> >
#define vi vector<int>
#define vpi vector< pair<int,int> >
#define sz(a) (int)a.size()
#define all(a)   a.begin() , a.end()
//#define for(i,q,n) for(int i=q ; i<n ; i++)
// inline void io(){
// // #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// // #endif
//  }

void solve() {
    int n , m ; cin >> n >> m ;
    int a[n] , cf[n] , sm = 0 ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;
    }
    sort(a,a+n,greater<int>() )  ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;   sm += a[i] ;        cf[i] = sm ;
    }
    int an = -1 ;
    for(int i0 = 1 ; i0 <= n ; i0 ++){
        int l = 1 , r = n ;
        int fl  = -1 , ct = 0 ;
        while(l<=r){// ct++;
            int mid = l + (r-l)/2  ;
            int k = (mid) / i0  ;
            int d = ((k-1)*k/2 )*i0  + (mid%i0)*k ;
            int v = cf[mid-1] - d ;
            if( v<0 ){
                r = mid - 1;
            }
            else if(v>=0 && v<m ){
                l = mid + 1 ;
            }
            else
                if( v>=m ){
                    r = mid-1 ;
                    fl = mid ;

            }
            // if(ct > n + 1 ){ break; }

        }
        if( fl != -1 ){
            an = i0 ; break ;
        }

    }
    cout << an << endl;
}

signed main () {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    // io();
    int t1 = 1 ;
    //  cin >> t1 ;
//    cout << fixed << setprecision(8);
    while(t1--){
        solve( ) ;
    }
}


//                                oppai daisukiii $$
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define double long double
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define P push
#define vvi vector<vector<int> >
#define vi vector<int>
#define vpi vector< pair<int,int> >
#define sz(a) (int)a.size()
#define all(a)   a.begin() , a.end()
//#define for(i,q,n) for(int i=q ; i<n ; i++)
// inline void io(){
// // #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// // #endif
//  }

void solve() {
    int n , m ; cin >> n >> m ;
    int a[n] , cf[n] , sm = 0 ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;
    }
    sort(a,a+n,greater<int>() )  ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;   sm += a[i] ;        cf[i] = sm ;
    }
    int an = -1 ;
    for(int i0 = 1 ; i0 <= n ; i0 ++){
        int l = 1 , r = n ;
        int fl  = -1 , ct = 0 ;
        while(l<=r){// ct++;
            int mid = l + (r-l)/2  ;
            int k = (mid) / i0  ;
            int d = ((k-1)*k/2 )*i0  + (mid%i0)*k ;
            int v = cf[mid-1] - d ;
            if( v<0 ){
                r = mid - 1;
            }
            else if(v>=0 && v<m ){
                if( a[mid] > k )
                    l = mid + 1 ;
                else
                r = mid - 1 ;
            }
            else
                if( v>=m ){
                    r = mid-1 ;
                    fl = mid ;

            }
            // if(ct > n + 1 ){ break; }

        }
        if( fl != -1 ){
            an = i0 ; break ;
        }

    }
    cout << an << endl;
}

signed main () {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    // io();
    int t1 = 1 ;
    //  cin >> t1 ;
//    cout << fixed << setprecision(8);
    while(t1--){
        solve( ) ;
    }
}


//                                oppai daisukiii $$
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define double long double
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define P push
#define vvi vector<vector<int> >
#define vi vector<int>
#define vpi vector< pair<int,int> >
#define sz(a) (int)a.size()
#define all(a)   a.begin() , a.end()
//#define for(i,q,n) for(int i=q ; i<n ; i++)
// inline void io(){
// // #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// // #endif
//  }

void solve() {
    int n , m ; cin >> n >> m ;
    int a[n] , cf[n] , sm = 0 ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;
    }
    sort(a,a+n,greater<int>() )  ;
    for(int i=0 ; i<n ;i++){
        cin >> a[i] ;   sm += a[i] ;        cf[i] = sm ;
    }
    int an = -1 ;
    for(int i0 = 1 ; i0 <= n ; i0 ++){
        int l = 1 , r = n ;
        int fl  = -1 , ct = 0 ;
        while(l<=r){ ct++;
            int mid = l + (r-l)/2  ;
            int k = (mid) / i0  ;
            int d = ((k-1)*k/2 )*i0  + (mid%i0)*k ;
            int v = cf[mid-1] - d ;
            if( v<0 ){
                r = mid - 1;
            }
            else if(v>0 && v<m ){
                l = mid + 1 ;
            }
            else
                if( v>=m ){
                    r = mid-1 ;
                    fl = mid ;

            }
            if(ct > n + 1 ){ break; }

        }
        if( fl != -1 ){
            an = i0 ; break ;
        }

    }
    cout << an << endl;
}

signed main () {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    // io();
    int t1 = 1 ;
    //  cin >> t1 ;
//    cout << fixed << setprecision(8);
    while(t1--){
        solve( ) ;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a.begin(),a.end(),greater<int>());
    queue<ll> q;
    for(int i=0;i<n;i++)
    q.push(a[i]);
    ll sum=accumulate(a.begin(),a.end(),(ll)0),count=1,flag=0;
    if(sum<m){
        cout<<-1<<endl;
        return 0;
    }
    // cout<<sum<<endl;
    while(!q.empty()&&(m>0)){
        if(((q.front()-flag)>0)&&(sum-q.front())>=(m-max((ll)0,q.front()-flag))){
            // cout<<sum-q.front()<<" "<<m-q.front()+flag<<endl;
            m=m-max((ll)0,q.front()-flag);
            sum-=q.front();
            flag++;
            q.pop();
        }
        // else if((q.size()==1)&&((sum-q.front())==(m-max((ll)0,q.front()-flag)))){
        //     m=m-max((ll)0,q.front()-flag);
        //     sum-=q.front();
        //     flag++;
        //     q.pop();
        // }
        else {
            flag=0;
            count++;
        }
        // cout<<m<<endl;
    }
    cout<<count<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a.begin(),a.end(),greater<int>());
    queue<ll> q;
    for(int i=0;i<n;i++)
    q.push(a[i]);
    ll sum=accumulate(a.begin(),a.end(),(ll)0),count=1,flag=0;
    if(sum<m){
        cout<<-1<<endl;
        return 0;
    }
    while(!q.empty()){
        if((sum-q.front())>(m-max((ll)0,q.front()-flag))){
            // cout<<sum-q.front()<<" "<<m-q.front()+flag<<endl;
            m=m-max((ll)0,q.front()-flag);
            sum-=q.front();
            flag++;
            q.pop();
        }
        else if((q.size()==1)&&((sum-q.front())==(m-max((ll)0,q.front()-flag)))){
            m=m-max((ll)0,q.front()-flag);
            sum-=q.front();
            flag++;
            q.pop();
        }
        else {
            flag=0;
            count++;
        }
        // cout<<m<<endl;
    }
    cout<<count<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
bool cost(vector<ll>& a,ll m,ll x){
	ll sum=0;
	for(ll i=0;i<a.size();i++)
	sum+=max((ll)0,(a[i]-i/x));
//	cout<<x<<" "<<sum<<endl;
	if(sum>=m)
	return true;
	else return false;
}
int main(){
	ll n,m;
	cin>>n>>m;
	vector<ll> a(n);
	for(ll i=0;i<n;i++)
	cin>>a[i];
	if(accumulate(a.begin(),a.end(),0)<m){
		cout<<-1<<endl;
		return 0;
	}
	sort(a.begin(),a.end(),greater<ll>());
	ll l=1,r=n,mid;
	while(l<r){
		mid=(l+r)/2;
//		cout<<l<<" "<<r<<" "<<mid<<endl;
//		cout<<mid<<endl;
		if(cost(a,m,mid))
		r=mid;
		else l=mid+1;
	}
	cout<<l<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    ll n,m;
    cin>>n>>m;
    vector<ll> a(n);
    for(int i=0;i<n;i++)
    cin>>a[i];
    sort(a.begin(),a.end(),greater<int>());
    queue<ll> q;
    for(int i=0;i<n;i++)
    q.push(a[i]);
    ll sum=accumulate(a.begin(),a.end(),(ll)0),count=1,flag=0;
    if(sum<m){
        cout<<-1<<endl;
        return 0;
    }
    while(!q.empty()&&(m>0)){
        if((sum-q.front())>(m-max((ll)0,q.front()-flag))){
            // cout<<sum-q.front()<<" "<<m-q.front()+flag<<endl;
            m=m-max((ll)0,q.front()-flag);
            sum-=q.front();
            flag++;
            q.pop();
        }
        else if((q.size()==1)&&((sum-q.front())==(m-max((ll)0,q.front()-flag)))){
            m=m-max((ll)0,q.front()-flag);
            sum-=q.front();
            flag++;
            q.pop();
        }
        else {
            flag=0;
            count++;
        }
        // cout<<m<<endl;
    }
    cout<<count<<endl;
}