#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define precision(a) fixed << setprecision(a)
#define all(a) a.begin(), a.end()
#define VI(a) vector<ll> a
#define pll(a) pair<ll, ll> a
#define pbb(a) pair<bool, bool> a
#define pb(a) push_back(a)
#define endl "\n"
#define T ll t;cin>>t;while(t--)
#define lb (a, b) lower_bound(all(a, b))
#define ub (a, b) upper_bound(all(a, b))
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define MCI(a) map<char, ll> a
#define speed                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
#define debuga(a, l, r)              \
	fi(l, r, i) cout << a[i] << " "; \
	cout << endl
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;

vector<bool> prime(1000000, 1);
ll M = 1e9 + 7;
ll powmodM(ll a, ll b, ll c = M)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a) % M;
		a = (a * a) % M;
		b /= 2;
	}
	return res;
}
ll power(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b /= 2;
	}
	return res;
}
ll gcd(ll a, ll b)
{
	while (a && b)
		a > b ? a %= b : b %= a;
	return a + b;
}
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
VI()
sieve(int n)
{
	VI(ans);
	prime[0] = false;
	prime[1] = false;
	for (int p = 2; p * p <= n; p++)
		if (prime[p])
			for (int i = p * p; i <= n; i += p)
				prime[i] = 0;
	fi(2, n, p) if (prime[p]) ans.push_back(p);
	return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
	if (r == 0)
		return 1;
	ll fac[n + 1];
	fac[0] = 1;
	fi(1, n, i) fac[i] = fac[i - 1] * i % p;
	return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
int findMin(VI(dis),VI(visited),int n){
	int min=INT_MAX;
	int inde=-1;
	fi(1,n,i)if(dis[i]<min&&!visited[i]){min=dis[i];inde=i;}
	return inde;
}

ll dfs(int parent,vector<vector<pair<int,int>>>list,VI()visited){
	visited[parent]=1;
	int len=list[parent].size();
	ll count=0;
	fi(0,len-1,i){
		if (!list[parent][i].second)
			count+=dfs(list[parent][i].first, list,visited);
	}
	return count+1;
}

int main()
{
	speed;
	ll n,m;cin>>n>>m;
	VI(arr(n));VI(brr(m));
	fi(0,n-1,i)cin>>arr[i];	fi(0,m-1,i)cin>>brr[i];
	sort(all(arr));	sort(all(brr));
	VI(res);if(n==1){cout<<0;return 0;}
if(m==1){
	cout<<min(arr[n-1]*brr[0],arr[0]*brr[0]);return 0;
}
	res.push_back(arr[n - 2] * brr[m - 1]);
	if(arr[0]*brr[0]>arr[n - 1] * brr[m - 1])res.push_back(arr[n - 1] * brr[m - 1]);
	if(arr[0]*brr[0]<arr[n - 1] * brr[m - 1])res.push_back(arr[0] * brr[0]);
	if(arr[0]*brr[0]==arr[n - 1]* brr[m - 1]){
		if(arr[1] * brr[0]<arr[n-2]*brr[m-1])
			res.push_back(arr[1] * brr[0]);
		else	res.push_back(arr[n-2] * brr[m-1]);
	}
	res.push_back(arr[1] * brr[0]);
	sort(all(res));
	cout<<res[res.size()-1];

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define T     \
    int t;    \
    cin >> t; \
    while (t--)
#define vvi vector<vector<int>>
#define vpi vector<pii>
#define mii map<int, int>
#define mci map<char, int>
#define umii unordered_map<int, int>
#define si set<int>
#define spi set<pii>
#define usi unordered_set<int>
#define que_max priority_queue<int>
#define que_min priority_queue<int, vi, greater<int>>
#define sz(x) x.size()
#define all(p) p.begin(), p.end()
#define endl "\n"
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define debuga(a, l, r)              \
    fi(l, r, i) cout << a[i] << " "; \
    cout << endl;
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x, y, z, w, v) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
ll M = 1e9 + 7;
ll M1 = 998244353;
ll powmodM(ll a, ll b, ll c)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a) % c;
        a = (a * a) % c;
        b /= 2;
    }
    return res;
}
ll power(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b /= 2;
    }
    return res;
}
ll lcm(ll a, ll b) { return (max(a, b) / __gcd(a, b)) * min(a, b); }
vi sieve(int n)
{
    vi ans, prime(2e6, 1);
    prime[0] = 0;
    prime[1] = 0;
    for (int p = 2; p * p <= n; p++)
        if (prime[p])
            for (int i = p * p; i <= n; i += p)
                prime[i] = 0;
    fi(2, n, p) if (prime[p]) ans.push_back(p);
    return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    fi(1, n, i) fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
class dll
{
public:
    int data;
    dll *next;
    dll *prev;
    dll(int a)
    {
        data = a;
        prev = NULL;
        next = NULL;
    }
};
int isPrime(int a)
{
    fi(2, sqrt(a), i)
    {
        if (a % i == 0)
            return 0;
    }
    return 1;
}
void aps()
{
    speed;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
vvi graph;
vi visited;
int a, b;

void bfs(int curr){
    queue<int> pn;
    pn.push(curr);
    pn.push(-1);
    int level=1;
    while(pn.size()>1){
        int top=pn.front();
        pn.pop();
        if(top==-1){
            pn.push(-1);
            level++;
        }
        if(visited[top])continue;
        visited[top]=level;
        int siz=graph[curr].size();
        for(int i=0;i<siz;i++){
            pn.push(graph[curr][i]);
        }
    }
}

void dfs(int curr, int type)
{
    if (a == -1)
        return;
    if (visited[curr] && visited[curr] == type)
        return;
    if (visited[curr])
    {
        a = -1;
        return;
    }
    visited[curr] = type;
    if (type == 1)
        a++;
    else
        b++;
    int siz = graph[curr].size();
    fi(0, siz - 1, i)
    {
        dfs(graph[curr][i], type == 1 ? 2 : 1);
    }
}

int32_t main()
{
    speed;
    int n,m;
    cin>>n>>m;
    vi arr(n),brr(m);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<m;i++){
        cin>>brr[i];
    }
    sort(arr.begin(),arr.end());
    sort(brr.begin(),brr.end());
    vi res;
    res.push_back(arr[n-1]*brr[m-1]);
    res.push_back(arr[n-2]*brr[m-1]);
    res.push_back(arr[0]*brr[0]);
    res.push_back(arr[1]*brr[0]);
    sort(res.begin(),res.end());
    cout<<res[2]<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define vi vector<int>
#define rep(n,i)for(int i=0;i<n;i++)
#define S(a) sort(a.begin(),a.end())
ll res(ll n,ll k){
	debug2(n,k)
   if(n<=2)return n;
   if(n%k==0)return res(n/k,k)+1;
   ll t = n/k;
   return (n-(t*k))+((t)?1:0)+res(t,k);
}
main(){
	ll n,m;cin>>n>>m;
	vi arr(n),brr(m);
	rep(n,i)cin>>arr[i];
	rep(n,i)cin>>brr[i];
	S(arr),S(brr);
	vector<pair<int,int>> p;
	int ans=INT_MIN;
	int a1=arr[0],a2=arr[1],b1=arr[n-1],b2=arr[n-2],c=brr[0],d=brr[m-1];
	p.push_back({a1*c,0});
	p.push_back({a2*c,1});
	p.push_back({b1*d,3});
	p.push_back({a1*d,4});
	sort(p.rbegin(),p.rend());
	if(p[0].second==0){
		cout<<max(p[1].first,p[2].first);
	}else if(p[0].second==3){
		cout<<max(p[3].first,p[0].first);
	}
	// if(a2<=0&&c<=0)ans=max(ans,a2*c);
	// if(b2>=0&&d>=0)ans=max(ans,b2*d);
	// if(b1*d>=a1*c)ans=max(ans,a1*c);
	// if(b1*d<=a1*c)ans=max(ans,b1*d);
	// cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define vi vector<int>
#define rep(n,i)for(int i=0;i<n;i++)
#define S(a) sort(a.begin(),a.end())
ll res(ll n,ll k){
	debug2(n,k)
   if(n<=2)return n;
   if(n%k==0)return res(n/k,k)+1;
   ll t = n/k;
   return (n-(t*k))+((t)?1:0)+res(t,k);
}
main(){
	ll n,m;cin>>n>>m;
	vi arr(n),brr(m);
	rep(n,i)cin>>arr[i];
	rep(n,i)cin>>brr[i];
	S(arr),S(brr);
	vector<pair<int,int>> p;
	int ans=INT_MIN;
	int a1=arr[0],a2=arr[1],b1=arr[n-1],b2=arr[n-2],c=brr[0],d=brr[m-1];
	p.push_back({a1*c,0});
	p.push_back({a2*c,1});
	p.push_back({b1*d,3});
	p.push_back({b2*d,4});
	sort(p.rbegin(),p.rend());
	// debug2(p[0].second,max(p[3].first,p[0].first))
	if(p[0].second==0){
		cout<<max(a2*c,b1*d);
	}else if(p[0].second==3){
		cout<<max(b2*d,a1*c);
	}
	// if(a2<=0&&c<=0)ans=max(ans,a2*c);
	// if(b2>=0&&d>=0)ans=max(ans,b2*d);
	// if(b1*d>=a1*c)ans=max(ans,a1*c);
	// if(b1*d<=a1*c)ans=max(ans,b1*d);
	// cout<<ans<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define precision(a) fixed << setprecision(a)
#define all(a) a.begin(), a.end()
#define VI(a) vector<ll> a
#define pll(a) pair<ll, ll> a
#define pbb(a) pair<bool, bool> a
#define pb(a) push_back(a)
#define endl "\n"
#define T     \
	ll t;     \
	cin >> t; \
	while (t--)
#define lb (a, b) lower_bound(all(a, b))
#define ub (a, b) upper_bound(all(a, b))
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define MCI(a) map<char, ll> a
#define speed                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
#define debuga(a, l, r)              \
	fi(l, r, i) cout << a[i] << " "; \
	cout << endl
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;

vector<bool> prime(1000000, 1);
ll M = 1e9 + 7;
ll powmodM(ll a, ll b, ll c = M)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a) % M;
		a = (a * a) % M;
		b /= 2;
	}
	return res;
}
ll power(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b /= 2;
	}
	return res;
}
ll gcd(ll a, ll b)
{
	while (a && b)
		a > b ? a %= b : b %= a;
	return a + b;
}
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
VI()
sieve(int n)
{
	VI(ans);
	prime[0] = false;
	prime[1] = false;
	for (int p = 2; p * p <= n; p++)
		if (prime[p])
			for (int i = p * p; i <= n; i += p)
				prime[i] = 0;
	fi(2, n, p) if (prime[p]) ans.push_back(p);
	return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
	if (r == 0)
		return 1;
	ll fac[n + 1];
	fac[0] = 1;
	fi(1, n, i) fac[i] = fac[i - 1] * i % p;
	return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
int findMin(VI(dis), VI(visited), int n)
{
	int min = INT_MAX;
	int inde = -1;
	fi(1, n, i) if (dis[i] < min && !visited[i])
	{
		min = dis[i];
		inde = i;
	}
	return inde;
}

ll dfs(int parent, vector<vector<pair<int, int>>> list, VI() visited)
{
	visited[parent] = 1;
	int len = list[parent].size();
	ll count = 0;
	fi(0, len - 1, i)
	{
		if (!list[parent][i].second)
			count += dfs(list[parent][i].first, list, visited);
	}
	return count + 1;
}

int main()
{
	speed;
	ll n, m;
	cin >> n >> m;
	VI(arr(n));
	VI(brr(m));
	fi(0, n - 1, i) cin >> arr[i];
	fi(0, m - 1, i) cin >> brr[i];
	ll max=INT_MIN,ii=-1,jj=-1;
	fi(0,n-1,i){
		fi(0,m-1,j){
			if(max<arr[i]*brr[j]){
				max=arr[i]*brr[j];
				ii=i,jj=j;
			}
		}
	}max=INT_MIN;
	fi(0,n-1,i){
		if(i==ii)continue;
		fi(0,m-1,j){
			// cout<<"ok";debug3(ii,i,j)
			if(max<arr[i]*brr[j]){
				max=arr[i]*brr[j];

			}
		}
	}
	cout<<max;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define precision(a) fixed << setprecision(a)
#define all(a) a.begin(), a.end()
#define VI(a) vector<ll> a
#define pll(a) pair<ll, ll> a
#define pbb(a) pair<bool, bool> a
#define pb(a) push_back(a)
#define endl "\n"
#define T     \
	ll t;     \
	cin >> t; \
	while (t--)
#define lb (a, b) lower_bound(all(a, b))
#define ub (a, b) upper_bound(all(a, b))
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define MCI(a) map<char, ll> a
#define speed                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
#define debuga(a, l, r)              \
	fi(l, r, i) cout << a[i] << " "; \
	cout << endl
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;

vector<bool> prime(1000000, 1);
ll M = 1e9 + 7;
ll powmodM(ll a, ll b, ll c = M)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a) % M;
		a = (a * a) % M;
		b /= 2;
	}
	return res;
}
ll power(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b /= 2;
	}
	return res;
}
ll gcd(ll a, ll b)
{
	while (a && b)
		a > b ? a %= b : b %= a;
	return a + b;
}
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
VI()
sieve(int n)
{
	VI(ans);
	prime[0] = false;
	prime[1] = false;
	for (int p = 2; p * p <= n; p++)
		if (prime[p])
			for (int i = p * p; i <= n; i += p)
				prime[i] = 0;
	fi(2, n, p) if (prime[p]) ans.push_back(p);
	return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
	if (r == 0)
		return 1;
	ll fac[n + 1];
	fac[0] = 1;
	fi(1, n, i) fac[i] = fac[i - 1] * i % p;
	return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
int findMin(VI(dis), VI(visited), int n)
{
	int min = INT_MAX;
	int inde = -1;
	fi(1, n, i) if (dis[i] < min && !visited[i])
	{
		min = dis[i];
		inde = i;
	}
	return inde;
}

ll dfs(int parent, vector<vector<pair<int, int>>> list, VI() visited)
{
	visited[parent] = 1;
	int len = list[parent].size();
	ll count = 0;
	fi(0, len - 1, i)
	{
		if (!list[parent][i].second)
			count += dfs(list[parent][i].first, list, visited);
	}
	return count + 1;
}

int main()
{
	speed;
	ll n, m;
	cin >> n >> m;
	VI(arr(n));
	VI(brr(m));
	VI(res);
	fi(0, n - 1, i) cin >> arr[i];
	fi(0, m - 1, i) cin >> brr[i];
	ll max=INT_MIN,ii=-1,jj=-1;
	fi(0,n-1,i){
		fi(0,m-1,j){
			res.push_back(arr[i]*brr[j]);
		}
	}sort(all(res));
	cout<<res[res.size()-2];
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define T     \
    int t;    \
    cin >> t; \
    while (t--)
#define vvi vector<vector<int>>
#define vpi vector<pii>
#define mii map<int, int>
#define mci map<char, int>
#define umii unordered_map<int, int>
#define si set<int>
#define spi set<pii>
#define usi unordered_set<int>
#define que_max priority_queue<int>
#define que_min priority_queue<int, vi, greater<int>>
#define sz(x) x.size()
#define all(p) p.begin(), p.end()
#define endl "\n"
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define debuga(a, l, r)              \
    fi(l, r, i) cout << a[i] << " "; \
    cout << endl;
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x, y, z, w, v) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
ll M = 1e9 + 7;
ll M1 = 998244353;
ll powmodM(ll a, ll b, ll c)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a) % c;
        a = (a * a) % c;
        b /= 2;
    }
    return res;
}
ll power(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b /= 2;
    }
    return res;
}
ll lcm(ll a, ll b) { return (max(a, b) / __gcd(a, b)) * min(a, b); }
vi sieve(int n)
{
    vi ans, prime(2e6, 1);
    prime[0] = 0;
    prime[1] = 0;
    for (int p = 2; p * p <= n; p++)
        if (prime[p])
            for (int i = p * p; i <= n; i += p)
                prime[i] = 0;
    fi(2, n, p) if (prime[p]) ans.push_back(p);
    return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    fi(1, n, i) fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
class dll
{
public:
    int data;
    dll *next;
    dll *prev;
    dll(int a)
    {
        data = a;
        prev = NULL;
        next = NULL;
    }
};
int isPrime(int a)
{
    fi(2, sqrt(a), i)
    {
        if (a % i == 0)
            return 0;
    }
    return 1;
}
void aps()
{
    speed;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
vvi graph;
vi visited;
int a, b;

void bfs(int curr){
    queue<int> pn;
    pn.push(curr);
    pn.push(-1);
    int level=1;
    while(pn.size()>1){
        int top=pn.front();
        pn.pop();
        if(top==-1){
            pn.push(-1);
            level++;
        }
        if(visited[top])continue;
        visited[top]=level;
        int siz=graph[curr].size();
        for(int i=0;i<siz;i++){
            pn.push(graph[curr][i]);
        }
    }
}

void dfs(int curr, int type)
{
    if (a == -1)
        return;
    if (visited[curr] && visited[curr] == type)
        return;
    if (visited[curr])
    {
        a = -1;
        return;
    }
    visited[curr] = type;
    if (type == 1)
        a++;
    else
        b++;
    int siz = graph[curr].size();
    fi(0, siz - 1, i)
    {
        dfs(graph[curr][i], type == 1 ? 2 : 1);
    }
}

int32_t main()
{
    speed;
    int n,m;
    cin>>n>>m;
    vi arr(n),brr(m);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<m;i++){
        cin>>brr[i];
    }
    sort(arr.begin(),arr.end());
    sort(brr.begin(),brr.end());
    bool h=0;
    if(arr[n-1]<0&&brr[0]>=0)cout<<arr[n-2]*brr[0],h=1;
    if(arr[n-1]>=0&&brr[m-1]<0)cout<<arr[n-2]*brr[m-1],h=1;
    if(h)return 0;
    vi res;
    res.push_back(arr[n-1]*brr[m-1]);
    res.push_back(arr[n-2]*brr[m-1]);
    res.push_back(arr[0]*brr[0]);
    res.push_back(arr[1]*brr[0]);
    sort(res.begin(),res.end());
    cout<<res[2]<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define precision(a) fixed << setprecision(a)
#define all(a) a.begin(), a.end()
#define VI(a) vector<ll> a
#define pll(a) pair<ll, ll> a
#define pbb(a) pair<bool, bool> a
#define pb(a) push_back(a)
#define endl "\n"
#define T     \
	ll t;     \
	cin >> t; \
	while (t--)
#define lb (a, b) lower_bound(all(a, b))
#define ub (a, b) upper_bound(all(a, b))
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define MCI(a) map<char, ll> a
#define speed                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
#define debuga(a, l, r)              \
	fi(l, r, i) cout << a[i] << " "; \
	cout << endl
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;

vector<bool> prime(1000000, 1);
ll M = 1e9 + 7;
ll powmodM(ll a, ll b, ll c = M)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a) % M;
		a = (a * a) % M;
		b /= 2;
	}
	return res;
}
ll power(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b /= 2;
	}
	return res;
}
ll gcd(ll a, ll b)
{
	while (a && b)
		a > b ? a %= b : b %= a;
	return a + b;
}
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
VI()
sieve(int n)
{
	VI(ans);
	prime[0] = false;
	prime[1] = false;
	for (int p = 2; p * p <= n; p++)
		if (prime[p])
			for (int i = p * p; i <= n; i += p)
				prime[i] = 0;
	fi(2, n, p) if (prime[p]) ans.push_back(p);
	return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
	if (r == 0)
		return 1;
	ll fac[n + 1];
	fac[0] = 1;
	fi(1, n, i) fac[i] = fac[i - 1] * i % p;
	return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
int findMin(VI(dis), VI(visited), int n)
{
	int min = INT_MAX;
	int inde = -1;
	fi(1, n, i) if (dis[i] < min && !visited[i])
	{
		min = dis[i];
		inde = i;
	}
	return inde;
}

ll dfs(int parent, vector<vector<pair<int, int>>> list, VI() visited)
{
	visited[parent] = 1;
	int len = list[parent].size();
	ll count = 0;
	fi(0, len - 1, i)
	{
		if (!list[parent][i].second)
			count += dfs(list[parent][i].first, list, visited);
	}
	return count + 1;
}

int main()
{
	speed;
	ll n, m;
	cin >> n >> m;
	VI(arr(n));
	VI(brr(m));
	fi(0, n - 1, i) cin >> arr[i];
	fi(0, m - 1, i) cin >> brr[i];
	ll max=INT_MIN,ii=-1,jj=-1;
	fi(0,n-1,i){
		fi(0,m-1,j){
			if(max<arr[i]*brr[j]){
				max=arr[i]*brr[j];
				ii=i,jj=j;
			}
		}
	}max=INT_MIN;
	fi(0,n-1,i){
		fi(0,m-1,j){
			if(i==ii&&jj==j)continue;
			if(max<arr[i]*brr[j]){
				max=arr[i]*brr[j];

			}
		}
	}
	cout<<max;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define precision(a) fixed << setprecision(a)
#define all(a) a.begin(), a.end()
#define VI(a) vector<ll> a
#define pll(a) pair<ll, ll> a
#define pbb(a) pair<bool, bool> a
#define pb(a) push_back(a)
#define endl "\n"
#define T     \
	ll t;     \
	cin >> t; \
	while (t--)
#define lb (a, b) lower_bound(all(a, b))
#define ub (a, b) upper_bound(all(a, b))
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define MCI(a) map<char, ll> a
#define speed                         \
	ios_base::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL)
#define debuga(a, l, r)              \
	fi(l, r, i) cout << a[i] << " "; \
	cout << endl
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;

vector<bool> prime(1000000, 1);
ll M = 1e9 + 7;
ll powmodM(ll a, ll b, ll c = M)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a) % M;
		a = (a * a) % M;
		b /= 2;
	}
	return res;
}
ll power(ll a, ll b)
{
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = (res * a);
		a = (a * a);
		b /= 2;
	}
	return res;
}
ll gcd(ll a, ll b)
{
	while (a && b)
		a > b ? a %= b : b %= a;
	return a + b;
}
ll lcm(ll a, ll b) { return (max(a, b) / gcd(a, b)) * min(a, b); }
VI()
sieve(int n)
{
	VI(ans);
	prime[0] = false;
	prime[1] = false;
	for (int p = 2; p * p <= n; p++)
		if (prime[p])
			for (int i = p * p; i <= n; i += p)
				prime[i] = 0;
	fi(2, n, p) if (prime[p]) ans.push_back(p);
	return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
	if (r == 0)
		return 1;
	ll fac[n + 1];
	fac[0] = 1;
	fi(1, n, i) fac[i] = fac[i - 1] * i % p;
	return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
int findMin(VI(dis), VI(visited), int n)
{
	int min = INT_MAX;
	int inde = -1;
	fi(1, n, i) if (dis[i] < min && !visited[i])
	{
		min = dis[i];
		inde = i;
	}
	return inde;
}

ll dfs(int parent, vector<vector<pair<int, int>>> list, VI() visited)
{
	visited[parent] = 1;
	int len = list[parent].size();
	ll count = 0;
	fi(0, len - 1, i)
	{
		if (!list[parent][i].second)
			count += dfs(list[parent][i].first, list, visited);
	}
	return count + 1;
}

int main()
{
	speed;
	ll n, m;
	cin >> n >> m;
	VI(arr(n));
	VI(brr(m));
	fi(0, n - 1, i) cin >> arr[i];
	fi(0, m - 1, i) cin >> brr[i];
	ll max=INT_MIN,ii=-1;
	fi(0,n-1,i){
		fi(0,m-1,j){
			if(max<arr[i]*brr[j]){
				max=arr[i]*brr[j];
				ii=i;
			}
		}
	}max=INT_MIN;
	fi(0,n-1,i){
		if(i==ii)continue;
		fi(0,m-1,j){
			cout<<"ok";debug4(ii,i,j,max)
			if(max<arr[i]*brr[j]){
				max=arr[i]*brr[j];

			}
		}
	}
	cout<<max;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define T     \
    int t;    \
    cin >> t; \
    while (t--)
#define vvi vector<vector<int>>
#define vpi vector<pii>
#define mii map<int, int>
#define mci map<char, int>
#define umii unordered_map<int, int>
#define si set<int>
#define spi set<pii>
#define usi unordered_set<int>
#define que_max priority_queue<int>
#define que_min priority_queue<int, vi, greater<int>>
#define sz(x) x.size()
#define all(p) p.begin(), p.end()
#define endl "\n"
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define debuga(a, l, r)              \
    fi(l, r, i) cout << a[i] << " "; \
    cout << endl;
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x, y, z, w, v) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
ll M = 1e9 + 7;
ll M1 = 998244353;
ll powmodM(ll a, ll b, ll c)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a) % c;
        a = (a * a) % c;
        b /= 2;
    }
    return res;
}
ll power(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b /= 2;
    }
    return res;
}
ll lcm(ll a, ll b) { return (max(a, b) / __gcd(a, b)) * min(a, b); }
vi sieve(int n)
{
    vi ans, prime(2e6, 1);
    prime[0] = 0;
    prime[1] = 0;
    for (int p = 2; p * p <= n; p++)
        if (prime[p])
            for (int i = p * p; i <= n; i += p)
                prime[i] = 0;
    fi(2, n, p) if (prime[p]) ans.push_back(p);
    return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    fi(1, n, i) fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
class dll
{
public:
    int data;
    dll *next;
    dll *prev;
    dll(int a)
    {
        data = a;
        prev = NULL;
        next = NULL;
    }
};
int isPrime(int a)
{
    fi(2, sqrt(a), i)
    {
        if (a % i == 0)
            return 0;
    }
    return 1;
}
void aps()
{
    speed;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
vvi graph;
vi visited;
int a, b;

void bfs(int curr){
    queue<int> pn;
    pn.push(curr);
    pn.push(-1);
    int level=1;
    while(pn.size()>1){
        int top=pn.front();
        pn.pop();
        if(top==-1){
            pn.push(-1);
            level++;
        }
        if(visited[top])continue;
        visited[top]=level;
        int siz=graph[curr].size();
        for(int i=0;i<siz;i++){
            pn.push(graph[curr][i]);
        }
    }
}

void dfs(int curr, int type)
{
    if (a == -1)
        return;
    if (visited[curr] && visited[curr] == type)
        return;
    if (visited[curr])
    {
        a = -1;
        return;
    }
    visited[curr] = type;
    if (type == 1)
        a++;
    else
        b++;
    int siz = graph[curr].size();
    fi(0, siz - 1, i)
    {
        dfs(graph[curr][i], type == 1 ? 2 : 1);
    }
}

int32_t main()
{
    speed;
    int n,m;
    cin>>n>>m;
    vi arr(n),brr(m);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<m;i++){
        cin>>brr[i];
    }
    sort(arr.begin(),arr.end());
    sort(brr.begin(),brr.end());
    bool h=0;
    if(arr[n-1]<0&&brr[0]>=0)cout<<arr[n-2]*brr[0],h=1;
    if(arr[0]>=0&&brr[m-1]<0)cout<<arr[1]*brr[m-1],h=1;
    if(h)return 0;
    vi res;
    res.push_back(arr[n-1]*brr[m-1]);
    res.push_back(arr[n-2]*brr[m-1]);
    res.push_back(arr[0]*brr[0]);
    res.push_back(arr[1]*brr[0]);
    sort(res.begin(),res.end());
    cout<<res[2]<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define T     \
    int t;    \
    cin >> t; \
    while (t--)
#define vvi vector<vector<int>>
#define vpi vector<pii>
#define mii map<int, int>
#define mci map<char, int>
#define umii unordered_map<int, int>
#define si set<int>
#define spi set<pii>
#define usi unordered_set<int>
#define que_max priority_queue<int>
#define que_min priority_queue<int, vi, greater<int>>
#define sz(x) x.size()
#define all(p) p.begin(), p.end()
#define endl "\n"
#define fd(r, l, i) for (ll i = (r); i >= (l); --i)
#define fi(l, r, i) for (ll i = (l); i <= (r); ++i)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define speed                         \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define debuga(a, l, r)              \
    fi(l, r, i) cout << a[i] << " "; \
    cout << endl;
#define debug1(x) cout << #x " = " << x << endl;
#define debug2(x, y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define debug3(x, y, z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define debug4(x, y, z, w) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << endl;
#define debug5(x, y, z, w, v) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << " " << #w " = " << w << " " << #v " = " << v << endl;
ll M = 1e9 + 7;
ll M1 = 998244353;
ll powmodM(ll a, ll b, ll c)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a) % c;
        a = (a * a) % c;
        b /= 2;
    }
    return res;
}
ll power(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a);
        a = (a * a);
        b /= 2;
    }
    return res;
}
ll lcm(ll a, ll b) { return (max(a, b) / __gcd(a, b)) * min(a, b); }
vi sieve(int n)
{
    vi ans, prime(2e6, 1);
    prime[0] = 0;
    prime[1] = 0;
    for (int p = 2; p * p <= n; p++)
        if (prime[p])
            for (int i = p * p; i <= n; i += p)
                prime[i] = 0;
    fi(2, n, p) if (prime[p]) ans.push_back(p);
    return ans;
}
ll modInverse(ll n, ll p = M) { return powmodM(n, p - 2, p); }
ll nCrModP(ll n, ll r, ll p = M)
{
    if (r == 0)
        return 1;
    ll fac[n + 1];
    fac[0] = 1;
    fi(1, n, i) fac[i] = fac[i - 1] * i % p;
    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
double pie = 3.14159265358979323846264338;
const int INF = 0x3f3f3f3f;
class dll
{
public:
    int data;
    dll *next;
    dll *prev;
    dll(int a)
    {
        data = a;
        prev = NULL;
        next = NULL;
    }
};
int isPrime(int a)
{
    fi(2, sqrt(a), i)
    {
        if (a % i == 0)
            return 0;
    }
    return 1;
}
void aps()
{
    speed;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
vvi graph;
vi visited;
int a, b;

void bfs(int curr){
    queue<int> pn;
    pn.push(curr);
    pn.push(-1);
    int level=1;
    while(pn.size()>1){
        int top=pn.front();
        pn.pop();
        if(top==-1){
            pn.push(-1);
            level++;
        }
        if(visited[top])continue;
        visited[top]=level;
        int siz=graph[curr].size();
        for(int i=0;i<siz;i++){
            pn.push(graph[curr][i]);
        }
    }
}

void dfs(int curr, int type)
{
    if (a == -1)
        return;
    if (visited[curr] && visited[curr] == type)
        return;
    if (visited[curr])
    {
        a = -1;
        return;
    }
    visited[curr] = type;
    if (type == 1)
        a++;
    else
        b++;
    int siz = graph[curr].size();
    fi(0, siz - 1, i)
    {
        dfs(graph[curr][i], type == 1 ? 2 : 1);
    }
}

int32_t main()
{
    speed;
    int n,m;
    cin>>n>>m;
    vi arr(n),brr(m);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    for(int i=0;i<m;i++){
        cin>>brr[i];
    }
    sort(arr.begin(),arr.end());
    sort(brr.begin(),brr.end());
    bool h=0;
    if(arr[n-1]<0&&brr[0]>=0)cout<<arr[n-2]*brr[0],h=1;
    if(arr[0]>=0&&brr[m-1]<0)cout<<arr[n-2]*brr[m-1],h=1;
    if(h)return 0;
    vi res;
    res.push_back(arr[n-1]*brr[m-1]);
    res.push_back(arr[n-2]*brr[m-1]);
    res.push_back(arr[0]*brr[0]);
    res.push_back(arr[1]*brr[0]);
    sort(res.begin(),res.end());
    cout<<res[2]<<endl;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
double dp[1001][1001],pr[100001],dist[100001];
int n,k,e;

int ok(double r)
{
	int i,j;
	double sum=0.0;
	for(i=1;i<=n;i++)
	{
		if(dist[i]<r*r+eps)
		pr[i]=1.0;
		else
		pr[i]=double(exp(1 - dist[i]/(r*r)));
	}
	memset(dp,0,sizeof dp);
	dp[0][0]=1000;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=i;j++)
		dp[i][j]=1.0*dp[i-1][j]*(1-pr[i])+1.0*dp[i-1][j-1]*pr[i];
	}
	for(i=0;i<k;i++)
	sum+=dp[n][i];
	return sum<=e;
}

int main()
{
	cout<<fixed<<setprecision(10);
	double x,y,x0,y0,lo,mid,hi;
	int i,j;
	cin>>n>>k>>e;
	cin>>x0>>y0;
	for(i=1;i<=n;i++)
	{
		cin>>x>>y;
		dist[i]=(x-x0)*(x-x0)+(y-y0)*(y-y0);
	}
	lo=0.0;hi=10000.0;
	for(i=0;i<100;i++)
	{
		mid=(lo+hi)/2.0;
		if(ok(mid))
		hi=mid;
		else
		lo=mid;
	}
	cout<<lo;
	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;

typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef long double ldouble;

const ldouble PI = 3.1415926535897932384626433832795029L;

int K, X0, Y0;
double eps;
vector<int> X, Y;

bool f(double R) {
    int n=(int)X.size();
    vector<double> P(n);
    for (int i=0; i<n; i++) {
        double D=hypot(X[i]-X0, Y[i]-Y0);
        P[i]=D<=R?1:exp(1-(D*D)/(R*R));
    }
    vector<vector<double> > dp(n, vector<double>(K+1, 0));
    for (int i=0; i<n; i++) for (int j=0; j<=K; j++) {
        if (!j) dp[i][j]=1;
        else if (!i) dp[i][j]=j==1?P[i]:0;
        else dp[i][j]=P[i]*dp[i-1][j-1]+(1-P[i])*dp[i-1][j];
    }
    return dp[n-1][K]>=eps;
}

double search() {
    double from=0, to=10000;
    for (int i=0; i<1000; i++) {
        double mid=(from+to)/2;
        if (f(mid)) to=mid;
        else from=mid;
    }
    return (from+to)/2;
}

bool solve(int testNumber) {
    int n;
    if (scanf("%d", &n)==EOF) return false;
    scanf("%d %lf", &K, &eps);
    eps=1-eps/1000;
    scanf("%d %d", &X0, &Y0);
    X.resize(n);
    Y.resize(n);
    for (int i=0; i<n; i++) scanf("%d %d", &X[i], &Y[i]);
    printf("%.12f\n", search());
    return true;
}

int main() {
    for (int i=1; solve(i); i++);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef long double ldouble;

const ldouble PI = 3.1415926535897932384626433832795029L;

int K, X0, Y0;
double eps;
vector<int> X, Y;

bool f(double R) {
    int n=(int)X.size();
    vector<double> P(n);
    for (int i=0; i<n; i++) {
        double D=hypot(X[i]-X0, Y[i]-Y0);
        P[i]=D<=R?1:exp(1-(D*D)/(R*R));
    }
    vector<vector<double> > dp(n, vector<double>(K+1, 0));
    for (int i=0; i<n; i++) for (int j=0; j<=K; j++) {
        if (!j) dp[i][j]=1;
        else if (!i) dp[i][j]=j==1?P[i]:0;
        else dp[i][j]=P[i]*dp[i-1][j-1]+(1-P[i])*dp[i-1][j];
    }
    return dp[n-1][K]>=eps;
}

double search() {
    double from=0, to=2000;
    for (int i=0; i<1000; i++) {
        double mid=(from+to)/2;
        if (f(mid)) to=mid;
        else from=mid;
    }
    return (from+to)/2;
}

bool solve(int testNumber) {
    int n;
    if (scanf("%d", &n)==EOF) return false;
    scanf("%d %lf", &K, &eps);
    eps=1-eps/1000;
    scanf("%d %d", &X0, &Y0);
    X.resize(n);
    Y.resize(n);
    for (int i=0; i<n; i++) scanf("%d %d", &X[i], &Y[i]);
    printf("%.12f\n", search());
    return true;
}

int main() {
    for (int i=1; solve(i); i++);
    return 0;
}


#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;
}
//hello


#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);
}


/*
 * DATE : 2017-07-07
 * Algo :
*/
#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define FOR(I,A,B)              for(long long i=0; i < n ; i++ )
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-9
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl;
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 105;

int n,k,e;
double _x,_y;
double x[N],y[N];
bool vis[N][N];
double dp[N][N];

double coin[N];
double solve(int idx,int need)
{
    if(idx == n) return need == 0;
    if(vis[idx][need]) return dp[idx][need];
    vis[idx][need] = 1;
    double res = 0;
    if(need > 0)res += (coin[idx]) * solve(idx + 1,need - 1);
    res += (1 - coin[idx]) * solve(idx + 1, need );
    return dp[idx][need] = res;
}
bool can(double m)
{

    for(int i = 0; i < n;i ++ ){
        double t = (x[i] - _x) * (x[i] - _x) + (y[i]-_y)*(y[i]-_y);
        if(t <= m*m +EPS ) coin[i] = 1;
        else coin[i] = exp(1 - t / (m*m));
    }
    ms(vis,0);
    double pr  = 0;
    for(int c=  k; c <= n;c ++ ) {
        pr += solve(0,c);
    }
    if(pr*1000 >= e) return 1;
    return 0;
}
int main()
{
    cin >>n;
    cin >> k >> e;
    e = 1000-e;
    cin >> _x >> _y;
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];

    double low = 0, high= 1e6,mid,ans = 0;
    for(int i=0;i<100;i++){
        mid = (low + high)/2;
        if(can(mid)) {
            ans = mid;
            high = mid;
        }else low = mid;
    }
    cout << setprecision(10) << ans << endl;
    return 0;
}


/*
 * DATE : 2017-07-07
 * Algo :
*/
#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define FOR(I,A,B)              for(long long i=0; i < n ; i++ )
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-9
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl;
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 1001;

int n,k,e;
double _x,_y;
double x[N],y[N];

bool can(double m)
{
    double res = 0;
    int cnt = 0;
    for(int i = 0; i < n;i ++ ){
        double t = (x[i] - _x) * (x[i] - _x) + (y[i]-_y)*(y[i]-_y);
        if(t <= m * m + EPS ) res = 1;
        else res = exp(1 - t/(m*m));
        if(res * 1000 >= e) cnt++;
    }
    if(cnt >= k ) return 1;
    return 0;
}
int main()
{
    cin >>n;
    cin >> k >> e;
    e= 1000-e;
    cin >> _x >> _y;
    for(int i=0;i<n;i++) cin>>x[i]>>y[i];

    double low = 0, high= 1e6,mid,ans = 0;
    for(int i=0;i<100;i++){
        mid = (low + high)/2;
        if(can(mid)) {
            ans = mid;
            high = mid;
        }else low = mid;
    }
    cout << setprecision(10) << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <stack>
#include <algorithm>
using namespace std;

const double eps = 1e-10;
const double E = 2.7182818284590452353602874713527;
const int MAXN = 105;
int a[MAXN],b[MAXN];
double dp[MAXN],dp2[MAXN];

double fx(double x1,double y1,double x2,double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

int ok(double x,double y){
    if(x<y || fabs(x-y)<eps)return 1;
    return 0;
}

int main()
{
    int n,k,e;scanf("%d",&n);
    scanf("%d%d",&k,&e);
    int x,y;scanf("%d%d",&x,&y);
    int cnt=0;
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i],&b[i]);
        if(x==a[i]&&y==b[i])cnt++;
    }
    if(cnt>=k){
        printf("%.9lf\n",1.0);
        return 0;
    }
    double l=0,r=3000.0;
    double ans=r;
    while(r-l>eps){
        double mid=(l+r)/2;
        cnt=0;
        vector<int>q;
        for(int i=1;i<=n;i++){
            if(ok(fx(a[i],b[i],x,y),mid))cnt++;
            else q.push_back(i);
        }
        if(cnt>=k){
            ans=mid;
            r=mid;
            continue;
        }
        int mx=n-cnt;
        cnt=k-cnt;
        memset(dp,0,sizeof(dp));
        dp[0]=1.0;
        for(int i=0;i<mx;i++){
            memset(dp2,0,sizeof(dp2));
            int id=q[i];
            double temp=fx(a[id],b[id],x,y);
            temp=pow(E,(1.0-temp*temp/mid/mid));
            for(int j=0;j<=mx;j++){
                if(j>0)dp2[j]+=dp[j-1]*temp;
                dp2[j]+=dp[j]*(1.0-temp);
            }
            for(int j=0;j<=mx;j++)dp[j]=dp2[j];
        }
        double A=0.0;
        for(int i=cnt;i<=mx;i++)A+=dp[i];
        if(ok(1.0-e*1.0/1000,A)){
            ans=mid;
            r=mid;
        }
        else l=mid;
    }
    printf("%.9lf\n",ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <stack>
#include <algorithm>
using namespace std;

const double eps = 1e-10;
const double E = 2.7182818284590452353602874713527;
const int MAXN = 105;
int a[MAXN],b[MAXN];
double dp[MAXN],dp2[MAXN];

double fx(double x1,double y1,double x2,double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

int ok(double x,double y){
    if(x<y || fabs(x-y)<eps)return 1;
    return 0;
}

int main()
{
    int n,k,e;scanf("%d",&n);
    scanf("%d%d",&k,&e);
    int x,y;scanf("%d%d",&x,&y);
    int cnt=0;
    for(int i=1;i<=n;i++){
        scanf("%d%d",&a[i],&b[i]);
        if(x==a[i]&&y==b[i])cnt++;
    }
    if(cnt>=k){
        printf("%.9lf\n",0.0);
        return 0;
    }
    double l=0,r=3000.0;
    double ans=r;
    while(r-l>eps){
        double mid=(l+r)/2;
        cnt=0;
        vector<int>q;
        for(int i=1;i<=n;i++){
            if(ok(fx(a[i],b[i],x,y),mid))cnt++;
            else q.push_back(i);
        }
        if(cnt>=k){
            ans=mid;
            r=mid;
            continue;
        }
        int mx=n-cnt;
        cnt=k-cnt;
        memset(dp,0,sizeof(dp));
        dp[0]=1.0;
        for(int i=0;i<mx;i++){
            memset(dp2,0,sizeof(dp2));
            int id=q[i];
            double temp=fx(a[id],b[id],x,y);
            temp=pow(E,(1.0-temp*temp/mid/mid));
            for(int j=0;j<=mx;j++){
                if(j>0)dp2[j]+=dp[j-1]*temp;
                dp2[j]+=dp[j]*(1.0-temp);
            }
            for(int j=0;j<=mx;j++)dp[j]=dp2[j];
        }
        double A=0.0;
        for(int i=cnt;i<=mx;i++)A+=dp[i];
        if(ok(1.0-e*1.0/1000,A)){
            ans=mid;
            r=mid;
        }
        else l=mid;
    }
    printf("%.9lf\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const double e=2.7182818284590452353602874713527;
const double eps=1e-6;
const int maxn=1e2+5;
struct P
{
	double x,y;
}c[maxn];
int n,k,p;
double l,r,R,f[maxn][maxn],fail[maxn];
double getdis(double x,double y){return sqrt((x-c[0].x)*(x-c[0].x)+(y-c[0].y)*(y-c[0].y));}
double exp(double a){return pow(e,a);}
double calc(double D)
{
	if(D<=R)return 1.0;
	return exp(1.0-D*D/(R*R));
}
bool check(double mid)
{
	memset(f,0,sizeof(0));
	f[0][0]=1.0;
	R=mid;
	for(int i=1;i<=n;i++)
		fail[i]=1.0-calc(getdis(c[i].x,c[i].y));
	for(int i=1;i<=n;i++)
	{
		f[i][0]=f[i-1][0]*fail[i];
		for(int j=1;j<=i;j++)
			f[i][j]=f[i-1][j]*fail[i]+f[i-1][j-1]*(1-fail[i]);
	}
	double tmp=0.0;
	for(int i=0;i<k;i++)
		tmp+=f[n][i];
	return tmp<=p/1000.0;
}
int main()
{
	scanf("%d%d%d",&n,&k,&p);
	scanf("%lf%lf",&c[0].x,&c[0].y);
	for(int i=1;i<=n;i++)
		scanf("%lf%lf",&c[i].x,&c[i].y),r=max(r,getdis(c[i].x,c[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<bits/stdc++.h>
using namespace std;

#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll unsigned long long

#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
const int  maxn =1e2+5;
const int mod=9999991;
const int ub=1e6;
const double e=2.7182818284590452353602874713527 ;
const double eps=0.000000001;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

/*
题目大意：给定若干点的位置，和一个爆炸中心点，
问如果要想使得其爆炸失败的概率满足不大于给定值/1000，
（爆炸失败指 的是小于k 个点爆炸），最小的半径应该是多少。
明显的二分性质，注意上界应该取半径平方距离最大值。
对于搜索到的半径长度，用一下dp，
设dp（i，j）代表前i个炸了j个的概率，转移方程很好求，
注意代码细节即可，这道题代码要是短能更短，两个套路组合用一下就行。
时间复杂度：O(T*n*n)T为迭代次数。
wa了六次，前几次dp式子想错了，后面的是处理细节的问题。
*/

int n,k,f,K;
double x0,y0,R;
double x[maxn],y[maxn],ep[maxn];
double dp[maxn][maxn];

inline double p(double x)
{
    if(x<=R) return 1.0;
    return exp(1.0-x*x/(R*R));
}

inline double compute(double x,double y)
{
    return sqrt(x*x+y*y);
}

inline bool check(double r){
    mst(dp,0),dp[0][0]=1.0,R=r;
    for(int i=1;i<=n;i++)  ep[i]=p(compute(x0-x[i],y0-y[i]));///爆炸的概率
    for(int i=1;i<=n;i++){
        dp[i][0]=dp[i-1][0]*(1-ep[i]);
        for(int j=1;j<=i;j++)
            dp[i][j]=ep[i]*dp[i-1][j-1]+(1.0-ep[i])*dp[i-1][j];
    }
    double ans=0.0;for(int i=0;i<k;i++) ans+=dp[n][i];
    return ans<=f/1000.0;
}

int main()
{
    scanf("%d",&n);
    scanf("%d%d",&k,&f);
    scanf("%lf%lf",&x0,&y0);
    double l=0.0,r=0.0,ans;
    for(int i=1;i<=n;i++){
        scanf("%lf%lf",&x[i],&y[i]);
        r=max(r,compute(x[i]-x0,y[i]-y0));
    }
    int T=100;

    while(T--){
        double mid=(l+r)/2.0;
        if(check(mid)) {ans=mid;r=mid;}
        else {l=mid;}
    }
    printf("%.9f\n",ans);
    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(pow(a[i].x-X,2)+pow(a[i].y-Y,2));
    }
    sort(a+1,a+n+1,cmp);
    r=sqrt((a[k].dis*a[k].dis)/(1-log(p/1000)));
    printf("%.10lf",r);
    return 0;
}


// eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define X FI
#define Y SE
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else
#define debug(...)
#endif
inline ll getint(){
  ll _x=0,_tmp=1; char _tc=getchar();
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline ll add( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x + _y;
  if( _ >= _mod ) _ -= _mod;
  return _;
}
inline ll sub( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x - _y;
  if( _ < 0 ) _ += _mod;
  return _;
}
inline ll mul( ll _x , ll _y , ll _mod = mod7 ){
  ll _ = _x * _y;
  if( _ >= _mod ) _ %= _mod;
  return _;
}
ll mypow( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 1ll;
  ll _tmp = mypow( _a , _x / 2 , _mod );
  _tmp = mul( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = mul( _tmp , _a , _mod );
  return _tmp;
}
ll mymul( ll _a , ll _x , ll _mod ){
  if( _x == 0 ) return 0ll;
  ll _tmp = mymul( _a , _x / 2 , _mod );
  _tmp = add( _tmp , _tmp , _mod );
  if( _x & 1 ) _tmp = add( _tmp , _a , _mod );
  return _tmp;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
int __ = 1 , _cs;
/*********default*********/
#define N 111
int n , k , e;
Pt p[ N ];
inline Pt operator-( const Pt& p1 , const Pt& p2 ){
  return MP( p1.X - p2.X , p1.Y - p2.Y );
}
inline LD operator%( const Pt& p1 , const Pt& p2 ){
  return p1.X * p2.X + p1.Y * p2.Y;
}
inline LD norm( const Pt& tp ){
  return sqrt( tp % tp );
}
inline LD sqr( LD x ){
  return x * x;
}
void build(){

}
void init(){
  n = getint();
  k = getint();
  e = 1000 - getint();
  for( int i = 0 ; i <= n ; i ++ ){
    p[ i ].X = getint();
    p[ i ].Y = getint();
  }
}
LD dp[ N ][ N ];
LD prob[ N ];
inline bool okay( LD r ){
  int ott = 0 , itt = 0;
  for( int i = 1 ; i <= n ; i ++ ){
    LD dst = norm( p[ i ] - p[ 0 ] );
    if( dst < r + eps ) itt ++;
    else
      prob[ ++ ott ] = expl( 1.0 - sqr( dst ) / sqr( r ) );
  }
  if( itt >= k ) return true;
  for( int i = 0 ; i <= ott ; i ++ )
    for( int j = 0 ; j <= ott ; j ++ )
      dp[ i ][ j ] = 0.0;
  dp[ 1 ][ 1 ] = prob[ 1 ];
  dp[ 1 ][ 0 ] = 1.0 - prob[ 1 ];
  for( int i = 2 ; i <= ott ; i ++ )
    for( int j = 0 ; j < i ; j ++ ){
      dp[ i ][ j ] += dp[ i - 1 ][ j ] * ( 1.0 - prob[ i ] );
      dp[ i ][ j + 1 ] += dp[ i - 1 ][ j ] * prob[ i ];
    }
  LD acc = 0.0;
  for( int i = k - itt ; i <= ott ; i ++ )
    acc += dp[ ott ][ i ];
  return acc * 1000.0 + eps > (LD)e;
}
void solve(){
  LD l = 0 , r = 10000 , mid , ans = 0;
  for( int _ = 0 ; _ < 100 ; _ ++ ){
    mid = ( l + r ) * 0.5;
    if( okay( mid ) ) ans = mid , r = mid;
    else l = mid;
  }
  printf( "%.12f\n" , (D)ans );
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


#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(pow(a[i].x-X,2)+pow(a[i].y-Y,2));
    }
    sort(a+1,a+n+1,cmp);
    r=sqrt((a[k].dis*a[k].dis)/(1-log(1-p/1000)));
    printf("%.10lf",r);
    return 0;
}


#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 - logl(P)));
    return 0;
}


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

double e=2.7182818284590452353602874;
int k,p,n;
double pp[110],dp[110][110];
double want;

struct poi
{
	double x,y;
}a[110];

double get_dis(poi x,poi y)
{
	return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));
}

double get_p(double d,double r)
{
	if(d<=r) return 1.0;
	else return exp(1.0-d/r*d/r);
}

int check(double x)
{
	double ans=0;
	for(int i=1;i<=n;i++)
	{
		pp[i]=get_p(get_dis(a[i],a[0]),x);
	}
//	printf("r=%.6lf\n",x);
//	for(int i=1;i<=n;i++)
//	{
//		printf("%.6lf ",pp[i]);
//	}
//	memset(dp,0,sizeof(dp));
//	puts("");
	dp[0][0]=1.0;
	for(int i=1;i<=n;i++)
	{
		dp[i][0]=dp[i-1][0]*(1-pp[i]);
		for(int j=1;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j]*(1.0-pp[i])+dp[i-1][j-1]*pp[i];
		}
	}
	for(int i=k;i<=n;i++)
	{
		ans+=dp[n][i];
	}
//	printf("%.6lf\n",ans);
	return ans>=want;
}

int main()
{
	scanf("%d",&n);
	scanf("%d%d",&k,&p);
	want=1.0*p/1000;
	scanf("%lf%lf",&a[0].x,&a[0].y);
	for(int i=1;i<=n;i++)
	{
		scanf("%lf%lf",&a[i].x,&a[i].y);
	}
	want=1.0-want;
	int time=1000;
	double l=0,r=10000,mid;
	while(time--)
	{
//
//		_sleep(500);
		mid=(l+r)/2;
		if(check(mid))
		{
			r=mid;
		}
		else
		{
			l=mid;
		}
	}
	printf("%.9lf\n",mid);
}


#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <cassert>

using namespace std;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, k, xx, yy;
double e;
int x[100], y[100];
double dist[100];
double d[105];

int main() {
    scanf("%d%d%lf%d%d", &n, &k, &e, &xx, &yy);
    e *= 0.001;
    REP(i, n) scanf("%d%d", x + i, y + i);
    REP(i, n) dist[i] = (x[i] - xx) * (x[i] - xx) + (y[i] - yy) * (y[i] - yy);
    double lo = 0, hi = 10000, mid;
    REP(timer, 200) {
        mid = (lo + hi) / 2;
        double sureThing = 0;
        REP(i, n + 1) d[i] = 0;
        d[0] = 1;
        REP(i, n) if (dist[i] <= mid * mid) {
            ++sureThing;
        } else {
            double p = exp(1 - dist[i] / (mid * mid));
            for (int i = n; i > 0; --i) {
                d[i] += d[i - 1] * p;
                d[i - 1] *= 1 - p;
            }
        }
        double win = 0;
        REP(i, n + 1) if (sureThing + i >= k) {
            win += d[i];
        }
        if (1 - win > e)
            lo = mid;
        else
            hi = mid;
    }
    printf("%.12f\n", lo);
    return 0;
}


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

int n, k, e, x[111], y[111], X, Y;
double f[111][111];

// e o caso R = 0.0 funciona???

double hypot(double xx, double yy){
	return sqrt(xx*xx + yy*yy);
}

double dist(int i){
	return hypot(X-x[i], Y-y[i]);
}

double prob(int i, double R){
	if(dist(i)<=R) return 1.0;
	return exp( 1.0 - (dist(i)*dist(i))/(R*R) );
}

double pre(double R){
	for(int pos=n; pos>=0; pos--){
		for(int des=0; des<=n; des++){
			if(pos==n){
				if(des>=k){
					f[pos][des] = 0.0;
				}
				else{
					f[pos][des] = 1.0;
				}
			}
			else{
				double p = prob(pos, R);
				f[pos][des] = p*f[pos+1][des+1] + (1.0-p)*f[pos+1][des];
			}
		}
	}
	return f[0][0];
}

int main(){
	while(scanf("%d", &n)!=EOF){
		scanf("%d %d", &k, &e);
		scanf("%d %d", &X, &Y);
		for(int i=0; i<n; i++){
			scanf("%d %d", &x[i], &y[i]);
		}

		double lo = 0.0, hi = 2000.00;
		for(int it=0; it<100; it++){
			double mid = (hi+lo)/2.0;
			if(pre(mid)<=(((double)e)/1000.00)){
				hi = mid;
			}
			else{
				lo = mid;
			}
		}

		printf("%.20lf\n", lo);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define EPS 1e-10

int n, k, e, x[111], y[111], X, Y;
double f[111][111];

int compara(double xx, double yy){
	if(xx < (yy-EPS)) return -1;
	if(xx > (yy+EPS)) return  1;
	return 0;
}

double hypot(double xx, double yy){
	return sqrt(xx*xx + yy*yy);
}

double dist(int i){
	return hypot(X-x[i], Y-y[i]);
}

double prob(int i, double R){
	if(compara(dist(i), R)<=0 ) return 1.0;
	//if(dist(i) <= R) return 1.0;
	return exp( 1.0 - (dist(i)*dist(i))/(R*R) );
}

double pre(double R){
	for(int pos=n; pos>=0; pos--){
		for(int des=0; des<=n; des++){
			if(pos==n){
				if(des>=k){
					f[pos][des] = 0.0;
				}
				else{
					f[pos][des] = 1.0;
				}
			}
			else{
				double p = prob(pos, R);
				f[pos][des] = p*f[pos+1][des+1] + (1.0-p)*f[pos+1][des];
			}
		}
	}
	return f[0][0];
}

int main(){
	while(scanf("%d", &n)!=EOF){
		scanf("%d %d", &k, &e);
		scanf("%d %d", &X, &Y);
		for(int i=0; i<n; i++){
			scanf("%d %d", &x[i], &y[i]);
		}

		double lo = 0.0, hi = 2000.00;
		for(int it=0; it<100; it++){
			double mid = (hi+lo)/2.0;
			if(compara( pre(mid), (((double)e)/1000.00)) <= 0){
			//if(pre(mid)<= (((double)e)/1000.00)){
				hi = mid;
			}
			else{
				lo = mid;
			}
		}

		printf("%.20lf\n", lo);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define EPS 1e-10

int n, k, e, x[111], y[111], X, Y;
double f[111][111];

int compara(double xx, double yy){
	if(xx < (yy-EPS)) return -1;
	if(xx > (yy+EPS)) return  1;
	return 0;
}

double hypot(double xx, double yy){
	return sqrt(xx*xx + yy*yy);
}

double dist(int i){
	return hypot(X-x[i], Y-y[i]);
}

double prob(int i, double R){
	if(compara(dist(i), R)<=0 ) return 1.0;
	//if(dist(i) <= R) return 1.0;
	return exp( 1.0 - (dist(i)*dist(i))/(R*R) );
}

double pre(double R){
	for(int pos=n; pos>=0; pos--){
		for(int des=0; des<=n; des++){
			if(pos==n){
				if(des>=k){
					f[pos][des] = 0.0;
				}
				else{
					f[pos][des] = 1.0;
				}
			}
			else{
				double p = prob(pos, R);
				f[pos][des] = p*f[pos+1][des+1] + (1.0-p)*f[pos+1][des];
			}
		}
	}
	return f[0][0];
}

int main(){
	while(scanf("%d", &n)!=EOF){
		scanf("%d %d", &k, &e);
		scanf("%d %d", &X, &Y);
		for(int i=0; i<n; i++){
			scanf("%d %d", &x[i], &y[i]);
		}

		double lo = 0.0, hi = 4000.00;
		for(int it=0; it<100; it++){
			double mid = (hi+lo)/2.0;
			if(compara( pre(mid), (((double)e)/1000.00)) <= 0){
			//if(pre(mid)<= (((double)e)/1000.00)){
				hi = mid;
			}
			else{
				lo = mid;
			}
		}

		printf("%.20lf\n", lo);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define EPS 1e-10

int n, k, e, x[111], y[111], X, Y;
double f[111][111];

int compara(double xx, double yy){
	if(xx < (yy-EPS)) return -1;
	if(xx > (yy+EPS)) return  1;
	return 0;
}

double hypot(double xx, double yy){
	return sqrt(xx*xx + yy*yy);
}

double dist(int i){
	return hypot(X-x[i], Y-y[i]);
}

double prob(int i, double R){
	//if(compara(dist(i), R)<=0 ) return 1.0;
	if(dist(i) <= R) return 1.0;
	return exp( 1.0 - (dist(i)*dist(i))/(R*R) );
}

double pre(double R){
	for(int pos=n; pos>=0; pos--){
		for(int des=0; des<=n; des++){
			if(pos==n){
				if(des>=k){
					f[pos][des] = 0.0;
				}
				else{
					f[pos][des] = 1.0;
				}
			}
			else{
				double p = prob(pos, R);
				f[pos][des] = p*f[pos+1][des+1] + (1.0-p)*f[pos+1][des];
			}
		}
	}
	return f[0][0];
}

int main(){
	while(scanf("%d", &n)!=EOF){
		scanf("%d %d", &k, &e);
		scanf("%d %d", &X, &Y);
		for(int i=0; i<n; i++){
			scanf("%d %d", &x[i], &y[i]);
		}

		double lo = 0.0, hi = 4000.00;
		for(int it=0; it<100; it++){
			double mid = (hi+lo)/2.0;
			//if(compara( pre(mid), (((double)e)/1000.00)) <= 0){
			if(pre(mid)<= (((double)e)/1000.00)){
				hi = mid;
			}
			else{
				lo = mid;
			}
		}

		printf("%.20lf\n", lo);
	}
	return 0;
}


#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define ld double
#define X first
#define Y second
#define pb push_back
#define EPS 1e-9
#define all(a) (a).begin(), (a).end()
#define sz(a) int((a).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
using namespace std;
typedef pair<int, int> II;
typedef pair<II, int> III;

struct point {
    int x, y, dis;
    point(int x = 0, int y = 0, int dis = 0) : x(x), y(y), dis(dis) {}
};

int dist(point a, point b)
{
    return (a.x-b.x) * (a.x-b.x) + (a.y-b.y) * (a.y-b.y);
}

point bomb, a[110];
int n, K, ep;
ld p[110], dp[110][110];

ld sq(ld u)
{
    return u*u;
}

bool check(ld radius)
{
    if (radius < EPS) {
        FOR(i,1,n)
            if (a[i].x == bomb.x && a[i].y == bomb.y) p[i] = 1;
            else p[i] = 0;
    }
    FOR(i,1,n)
        if (a[i].dis <= sq(radius)) p[i] = 1;
        else p[i] = exp(1 - a[i].dis / sq(radius));
    FOR(i,0,n)
        FOR(j,0,n) dp[i][j] = 0;
    dp[0][0] = 1;
    FOR(i,1,n)
        FOR(j,0,i) {
            dp[i][j] = dp[i-1][j] * (1-p[i]);
            if (j) dp[i][j] += dp[i-1][j-1] * p[i];
        }
    ld prob = 0;
    FORE(i,K-1,0) prob += dp[n][i];
    return prob * 1000 <= ep;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> n;
    cin >> K >> ep;
    cin >> bomb.x >> bomb.y;
    FOR(i,1,n) {
        cin >> a[i].x >> a[i].y;
        a[i].dis = dist(a[i], bomb);
    }
    ld dau = 0, cuoi = 3000, mid;
    FOR(tes,1,300) {
        mid = (dau + cuoi) / 2;
        if (check(mid)) cuoi = mid;
        else dau = mid;
    }
    cout << fixed << setprecision(9) << cuoi;
    return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1.0 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] += (1 - dp[j]) * dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 2000, ans = 2000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0.0);
	else printf("%.17lf\n", solve());
	return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] = dp[j] * (1 - p) + dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	for(int i = K - cnt; i <= N; i++) if(dp[i] >= (1 - double(epsilon) / 1000.0)) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 2000, ans = 2000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0.0);
	else printf("%.17lf\n", solve());
	return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] = dp[j] * (1 - p) + dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	for(int i = K - cnt; i <= N; i++) if(dp[i] >= (1 - double(epsilon) / 1000.0)) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 2000, ans = 2000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0);
	else printf("%.17lf\n", solve());
	return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] += dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 2000, ans = 2000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0);
	else printf("%.17lf\n", solve());
	return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] = dp[j] * (1 - p) + dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	for(int i = K - cnt; i <= N; i++) if(dp[i] >= (1 - double(epsilon) / 1000.0)) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 4000, ans = 4000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0.0);
	else printf("%.17lf\n", solve());
	return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1.0 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] += (1 - dp[j]) * dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 2000, ans = 2000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0);
	else printf("%.17lf\n", solve());
	return 0;
}


# include <cmath>
# include <cstdio>
# include <iostream>
using namespace std;
const double eps = 1e-8;
int N, K, epsilon, X[105], Y[105];
double dp[105];
template<class T> void read(T & x)
{
	x = 0;
	int f = 1, ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		x = x * 10 - '0' + ch;
		ch = getchar();
	}
	x *= f;
}
bool judge(double x)
{
	for(int i = 0; i <= N; i++) dp[i] = 0;
	dp[0] = 1;
	int cnt = 0;
	for(int i = 1; i <= N; i++)
	{
		double d = (X[i] - X[0]) * (X[i] - X[0]) + (Y[i] - Y[0]) * (Y[i] - Y[0]);
		if(d <= x * x) cnt++;
		else
		{
			double p = exp(1 - d / (x * x));
			for(int j = N; j >= 1; j--)
			{
				dp[j] = dp[j] * (1 - p) + dp[j - 1] * p;
			}
		}
	}
	if(cnt >= K) return 1;
	return dp[K - cnt] >= (1 - double(epsilon) / 1000.0);
}
double solve()
{
	double l = eps, r = 4000, ans = 4000;
	while(r - l > eps)
	{
		double mid = (l + r) / 2;
		if(judge(mid)) r = mid, ans = mid;
		else l = mid;
	}
	return ans;
}
int main()
{
	read(N);
	read(K), read(epsilon);
	int flag = 0;
	for(int i = 0; i <= N; i++)
	{
		read(X[i]), read(Y[i]);
		if(i != 0 && X[i] == X[0] && Y[i] == Y[0]) flag++;
	}
	if(flag >= K) printf("%.17lf\n", 0.0);
	else printf("%.17lf\n", solve());
	return 0;
}


//Why 860?
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(v) ((ll)v.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define trace(x) cout << #x << " = " << x << endl
#define FER(i,x,y) for(int (i)=(x);(i)<(y); (i) ++)
#define IFR(i,x,y) for(int (i)=(x);(i)>=(y); (i) --)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef int ll;
typedef pair<ll,ll> ii;
typedef long double ld;

const int N = 1e2 + 2;
const ld EPS = 1e-9;
ld x[N], y[N];
ld xo, yo;
ld dp[N][N];
ld e;

ld getval(int k, int i, int j, ld mid){
	ld d = (x[i] - xo) *(x[i] - xo) + (y[i] - yo) * (y[i] - yo);
	ld p = (EPS + mid * mid >= d ? 1 : exp(1.0 - d / (mid * mid)));
	if(k > 0) return dp[i-1][j-1] * p + dp[i-1][j] * (1 - p);
	else return dp[i - 1][j]* (1 -p);
}

bool ok(ld mid, int k, int n){
	fill(dp, 0);
	dp[0][0] = 1;
	FER(i, 1, n + 1) FER(j, 0, i + 1) dp[i][j] = getval(k, i, j, mid);
	ld ans = 0;
	IFR(i, n, k) ans += dp[n][i];
	return 1 - e <= ans;
}

int main(){
	fastio;
	int n; cin >> n;
	int k; cin >> k >> e;
	e *= 0.001;
	cin >> xo >> yo;
	FER(i, 1, n + 1) cin >> x[i] >> y[i];
	ld low = 0, high = 1e18;
	FER(i, 0, 100){
		ld mid = (low + high) / 2;
		if(ok(mid, k, n)) high = mid;
		else low = mid;
	}
	cout << fixed << setprecision(10) << high << endl;
	return 0;
}


/*
その花を　咲かせば
あとは
枯れるのが　その定めか

その命　散らして
つなぐ
思いを全て　受け取って
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <cstdlib>
#include <utility>
#include <cmath>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define ayacin ios::sync_with_stdio(false);
#define mod 100000007
#define yukari 999999999
#define M_PI12 3.141592653
#define Parseedouble long double
#define lson o<<1
#define rson o<<1|
#define reimu iterator
#define N 10000005
int K,n,X,Y;
double d[105],P[105],p;
double dp[105][105];
bool check(double R){
	for(int i=1;i<=n;i++){
		if(R>=d[i]) P[i]=1;
		else P[i]=exp(1-d[i]*d[i]/R/R);
	}
	memset(dp,0,sizeof(dp));
	dp[1][1]=P[1];
	dp[1][0]=1-dp[1][1];
	for(int i=2;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j>=1) dp[i][j]+=P[i]*(dp[i-1][j-1]);
			dp[i][j]+=(1-P[i])*(dp[i-1][j]);
		}
	}
	double ans=0;
	for(int j=K;j<=n;j++) ans+=dp[n][j];
	return ans>=p;
}
int main(){
	int m,i,j,k;
	cin>>n;
	cin>>K>>p;
	cin>>X>>Y;
	p/=1000;
	p=1-p;
	for(i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		d[i]=(double)((x-X)*(x-X)+(y-Y)*(y-Y));
		d[i]=sqrt(d[i]);
	}
	double l=0,r=100000,o=50,ans=1000000;
	while(o--){
		double R=(l+r)/2;
		if(check(R)){
			ans=min(ans,R);
			r=R;
		}
		else l=R;
	}
	printf("%.9f\n",ans);
}


#include<bits/stdc++.h>
const int maxn=1e2+5;
const double e=2.7182818284590452353602874713527;
const double eps=1e-6;
using namespace std;
int n,k;
double f[maxn][maxn],p,r,l,tp[maxn];
struct node{
	double x,y;
}po[maxn];
double dis(int a,int b){
	return sqrt((po[a].x-po[b].x)*(po[a].x-po[b].x)+(po[a].y-po[b].y)*(po[a].y-po[b].y));
}
double epx(double D){return pow(e,D);}
double calc(double d,double R){
	if(d<=R)return 1.0;
	else return epx(1.0-d*d/(R*R));
}
bool check(double mi){
	memset(f,0,sizeof(f));
	f[0][0]=1.0;
	for(int i=1;i<=n;i++)tp[i]=1.0-calc(dis(0,i),mi);
	//for(int i=1;i<=n;i++)printf("%lf %lf %lf %lf ",tp[i],dis(0,i),calc(dis(0,i),mi),1.0-dis(0,i)*dis(0,i)/(mi*mi));
	//printf("%lf\n",mi);
	for(int i=1;i<=n;i++){
		f[i][0]=f[i-1][0]*tp[i];
		for(int j=1;j<=i;j++)f[i][j]=f[i-1][j]*tp[i]+f[i-1][j-1]*(1.0-tp[i]);
	}
	double sum=0.0;
	for(int i=0;i<k;i++)sum+=f[n][i];
	//printf("%lf %lf\n",sum,p/1000.0);
	return sum<=p/1000.0;
}
int main(){
	scanf("%d %d %lf %lf %lf",&n,&k,&p,&po[0].x,&po[0].y);
	for(int i=1;i<=n;i++)scanf("%lf %lf",&po[i].x,&po[i].y);
	for(int i=1;i<=n;i++)r=max(r,dis(0,i));
	while(l+eps<r){
		double mid=(l+r)/2.0;
	//	cout<<l<<" "<<r<<" "<<mid<<endl;
		if(check(mid))r=mid;
		else l=mid+eps;
	}
	printf("%lf\n",l);
	return 0;
}


#include<bits/stdc++.h>
const int maxn=1e2+5;
const double e=2.7182818284590452353602874713527;
const double eps=1e-6;
using namespace std;
int n,k;
double f[maxn][maxn],p,r,l,tp[maxn];
struct node{
	double x,y;
}po[maxn];
double dis(int a,int b){
	return sqrt((po[a].x-po[b].x)*(po[a].x-po[b].x)+(po[a].y-po[b].y)*(po[a].y-po[b].y));
}
double epx(double D){return pow(e,D);}
double calc(double d,double R){
	if(d<=R)return 1.0;
	else return epx(1.0-d*d/(R*R));
}
bool check(double mi){
	memset(f,0,sizeof(f));
	f[0][0]=1.0;
	for(int i=1;i<=n;i++)tp[i]=1.0-calc(dis(0,i),mi);
	//for(int i=1;i<=n;i++)printf("%lf %lf %lf %lf ",tp[i],dis(0,i),calc(dis(0,i),mi),1.0-dis(0,i)*dis(0,i)/(mi*mi));
	//printf("%lf\n",mi);
	for(int i=1;i<=n;i++){
		f[i][0]=f[i-1][0]*tp[i];
		for(int j=1;j<=i;j++)f[i][j]=f[i-1][j]*tp[i]+f[i-1][j-1]*(1.0-tp[i]);
	}
	double sum=0.0;
	for(int i=0;i<k;i++)sum+=f[n][i];
	//printf("%lf %lf\n",sum,p/1000.0);
	return sum<=p/1000.0;
}
int main(){
	scanf("%d %d %lf %lf %lf",&n,&k,&p,&po[0].x,&po[0].y);
	for(int i=1;i<=n;i++)scanf("%lf %lf",&po[i].x,&po[i].y);
	for(int i=1;i<=n;i++)r=max(r,dis(0,i));
	while(l+eps<r){
		double mid=(l+r)/2.0;
	//	cout<<l<<" "<<r<<" "<<mid<<endl;
		if(check(mid))r=mid;
		else l=mid+eps;
	}
	printf("%.12lf\n",l);
	return 0;
}


#include <iostream>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>

using namespace std;
const int N = 1228;

int n, k;
long double dp[N][N];
long double d[N];

long double func(long double r) {
    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 = 0; i < n; i++) {
        for(int j = 0; j <= n; j++) {
            if(d[i] <= r) {
                dp[i + 1][j + 1] += dp[i][j];
            } else {
                long double p = exp(1.0 - (d[i] * d[i]) / (r * r));
                dp[i + 1][j + 1] += p * dp[i][j];
                dp[i + 1][j] += (1 - p) * dp[i][j];
            }
        }
    }

    long double ans = 0;

    for(int i = k; i <= n; i++) {
        ans += dp[n][i];
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(false);

    cin >> n;
    long double e;
    cin >> k >> e;
    e /= 1000;
    e = 1 - e;

    long double x0, y0;
    cin >> x0 >> y0;

    for(int i = 0; i < n; i++) {
        long double x, y;
        cin >> x >> y;
        d[i] = sqrt((x0 - x) * (x0 - x) + (y0 - y) * (y0 - y));
    }

    long double l = 0, r = 1e5;
    while(r - l > 1e-6) {
        long double c = (l + r) / 2.0;
        if(func(c) < e)
            l = c;
        else
            r = c;
    }
    cout << fixed << setprecision(20) << (l + r) / 2.0 << "\n";

    return 0;
}


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

double e=2.7182818284590452353602874;
int k,p,n;
double pp[110],dp[110][110];
double want;

struct poi
{
	double x,y;
}a[110];

double get_dis(poi x,poi y)
{
	return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));
}

double get_p(double d,double r)
{
	if(d<=r) return 1.0;
	else return exp(1.0-d/r*d/r);
}

int check(double x)
{
	double ans=0;
	for(int i=1;i<=n;i++)
	{
		pp[i]=get_p(get_dis(a[i],a[0]),x);
	}
	memset(dp,0,sizeof(dp));
	dp[0][0]=1.0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j]*(1.0-pp[i])+dp[i-1][j-1]*pp[i];
		}
	}
	for(int i=k;i<=n;i++)
	{
		ans+=dp[n][i];
	}
	return ans>=want;
}

int main()
{
	scanf("%d",&n);
	scanf("%d%d",&k,&p);
	want=1.0*p/1000;
	scanf("%lf%lf",&a[0].x,&a[0].y);
	for(int i=1;i<=n;i++)
	{
		scanf("%lf%lf",&a[i].x,&a[i].y);
	}
	want=1.0-want;
	int time=1000;
	double l=0,r=10000,mid;
	while(time--)
	{
		mid=(l+r)/2;
		if(check(mid))
		{
			r=mid;
		}
		else
		{
			l=mid;
		}
	}
	printf("%.9lf\n",mid);
}


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

double e=2.7182818284590452353602874;
int k,p,n;
double pp[110],dp[110][110];
double want;

struct poi
{
	double x,y;
}a[110];

double get_dis(poi x,poi y)
{
	return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));
}

double get_p(double d,double r)
{
	if(d<=r) return 1.0;
	else return exp(1.0-d/r*d/r);
}

int check(double x)
{
	double ans=0;
	for(int i=1;i<=n;i++)
	{
		pp[i]=get_p(get_dis(a[i],a[0]),x);
	}
//	printf("r=%.6lf\n",x);
//	for(int i=1;i<=n;i++)
//	{
//		printf("%.6lf ",pp[i]);
//	}
//	memset(dp,0,sizeof(dp));
//	puts("");
	dp[0][0]=1.0;
	for(int i=1;i<=n;i++)
	{
		dp[i][0]=dp[i-1][0]*(1-pp[i]);
		for(int j=1;j<=i;j++)
		{
			dp[i][j]=dp[i-1][j]*(1.0-pp[i])+dp[i-1][j-1]*pp[i];
		}
	}
	for(int i=k;i<=n;i++)
	{
		ans+=dp[n][i];
	}
//	printf("%.6lf\n",ans);
	return ans>=want;
}

int main()
{
	scanf("%d",&n);
	scanf("%d%d",&k,&p);
	want=1.0*p/1000;
	scanf("%lf%lf",&a[0].x,&a[0].y);
	for(int i=1;i<=n;i++)
	{
		scanf("%lf%lf",&a[i].x,&a[i].y);
	}
	want=1.0-want;
	int time=1000;
	double l=0,r=10000,mid;
	while(time--)
	{
//
//		_sleep(500);
		mid=(l+r)/2;
		if(check(mid))
		{
			r=mid;
		}
		else
		{
			l=mid;
		}
	}
	printf("%.9lf\n",mid);
}


#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (buf1==buf2&&(buf2=(buf1=buf)+fread(buf,1,1<<23,stdin),buf1==buf2)?-1:*buf1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*buf1=buf,*buf2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int z=233;
typedef double db;
const db e=2.7182818284590452353602874713527;
int n,x[z],y[z],cx,cy,k;
db fail,dp[z][z];

db dis(int a,int b,int k) {return sqrt((a-x[k])*(a-x[k])+(b-y[k])*(b-y[k]));}
bool akioi(db br) {
db t; int i,j;
memset(dp,0,sizeof dp);
for (**dp=i=1;i<=n;++i)
  for (j=1;j<=n;++j)
    dp[i][j]=(t=dis(cx,cy,i))<=br?dp[i-1][j-1]:dp[i-1][j]*(1-pow(e,1-t*t/br/br))+dp[i-1][j-1]*pow(e,1-t*t/br/br);
db llx=0;
for (i=0;i<k;++i) llx+=dp[n][i];
return llx>fail;
}

int main() {
read(n); int i,t;
k=read(),fail=1.0*read()/1000;
cx=read(),cy=read();
for (i=1;i<=n;++i) x[i]=read(),y[i]=read();
db l=0,r=1e5,mid;
for (t=100;t--;akioi(mid)?l=mid:r=mid) mid=(l+r)/2;
printf("%.12lf\n",r);
}


#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (buf1==buf2&&(buf2=(buf1=buf)+fread(buf,1,1<<23,stdin),buf1==buf2)?-1:*buf1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*buf1=buf,*buf2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int z=233;
typedef double db;
const db e=2.7182818284590452353602874713527;
int n,x[z],y[z],cx,cy,k;
db fail,dp[z][z];

db dis(int a,int b,int k) {return sqrt((a-x[k])*(a-x[k])+(b-y[k])*(b-y[k]));}
bool akioi(db br) {
db t; int i,j;
memset(dp,0,sizeof dp);
for (**dp=i=1;i<=n;++i)
  for (dp[i][0]=dp[i-1][0]*((t=dis(cx,cy,i))<=br?0:(1-pow(e,1-t*t/br/br))),j=1;j<=n;++j)
    dp[i][j]=(t=dis(cx,cy,i))<=br?dp[i-1][j-1]:dp[i-1][j]*(1-pow(e,1-t*t/br/br))+dp[i-1][j-1]*pow(e,1-t*t/br/br);
db llx=0;
for (i=0;i<k;++i) llx+=dp[n][i];
return llx>fail;
}

int main() {
read(n); int i,t;
k=read(),fail=1.0*read()/1000;
cx=read(),cy=read();
for (i=1;i<=n;++i) x[i]=read(),y[i]=read();
db l=0,r=1e5,mid;
for (t=100;t--;akioi(mid)?l=mid:r=mid) mid=(l+r)/2;
printf("%.12lf\n",r);
}


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

const int MAXN = 110;

int n, k, ep;
double x[MAXN], y[MAXN], dp[MAXN][MAXN];

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

inline double dis(double x0, double y0, double x1, double y1) {
  return sqr(x0 - x1) + sqr(y0 - y1);
}

int main() {
  while (scanf("%d", &n) != EOF) {
    scanf("%d%d", &k, &ep);
    for (int i = 0; i <= n; ++i) scanf("%lf%lf", &x[i], &y[i]);
    double l = 0.0, r = 1e10;
    for (int iter = 0; iter < 100; ++iter) {
      double m = (l + r) * 0.5;
      dp[0][0] = 1.0;
      for (int i = 1; i <= n; ++i) {
        double d = dis(x[i], y[i], x[0], y[0]);
        double p = (d > m * m ? exp(1.0 - d / m / m) : 1.0);
        for (int j = 0; j <= i; ++j) {
          dp[i][j] = dp[i - 1][j] * (1 - p);
          if (j > 0) dp[i][j] += dp[i - 1][j - 1] * p;
        }
      }
      double fail = 0.0;
      for (int j = 0; j < k; ++j) fail += dp[n][j];
      if (fail * 1000 <= ep)
        r = m;
      else
        l = m;
    }
    printf("%.9lf\n", 0.5 * (l + r));
  }
  return 0;
}


#include <bits/stdc++.h>

using bomb = std::complex<long long>;

const int MAX_R = 1e3 + 3;
const int MAX_K = 1e2 + 2;
const double EPS = 1e-10;

std::vector<bomb> bombs;
double p ( const double R , const int i ) {
    double R2 = R*R;
    int d2 = std::norm(bombs[i]);

    if ( d2 <= R2 ) {
        return 1;
    }
    return exp(1 - d2 / R2);
}

std::unordered_map<int, double> dp;
double solve ( const double R , const int K , const int i ) {
    const int idx = K + (i+1) * MAX_K;
    if ( dp.count(idx) ) {
        return dp[idx];
    }
    double& answer = dp[idx];

    if ( K == 0 ) {
        return answer = 1;
    }
    if ( i == -1 ) {
        return answer = 0;
    }

    return answer = p(R, i) * solve(R, K - 1, i - 1) + (1 - p(R, i)) * solve(R, K, i - 1);
}

int main ( void ) {

    int n, k, e;
    std::cin >> n >> k >> e;

    double eps = 1.0 - e / 1000.0;

    int x0, y0;
    std::cin >> x0 >> y0;

    for ( int i = 0 ; i < n ; ++ i ) {
        int x, y;
        std::cin >> x >> y;
        bombs.emplace_back(bomb(x, y) - bomb(x0, y0));
    }

    double lo = 0;
    double hi = MAX_R;
    for ( int i = 0 ; i < 1000 && fabs(lo - hi) >= EPS ; ++ i ) {
        double r = (lo + hi) / 2;
        dp.clear();
        if ( solve(r, k, n-1) >= eps ) {
            hi = r;
        }
        else {
            lo = r;
        }
    }

    std::fixed(std::cout);
    std::cout.precision(16);
    std::cout << hi << std::endl;

    return 0;
}


#include <bits/stdc++.h>

using bomb = std::complex<long long>;

const int MAX_R = 1e3 + 3;
const int MAX_K = 1e2 + 2;
const double EPS = 1e-10;

std::vector<bomb> bombs;
double p ( const double R , const int i ) {
    double R2 = R*R;
    int d2 = std::norm(bombs[i]);

    if ( d2 <= R2 + EPS ) {
        return 1;
    }
    return exp(1.0 - d2 / R2);
}

std::unordered_map<int, double> dp;
double solve ( const double R , const int K , const int i ) {
    const int idx = K + (i+1) * MAX_K;
    if ( dp.count(idx) ) {
        return dp[idx];
    }
    double& answer = dp[idx];

    if ( K == 0 ) {
        return answer = 1;
    }
    if ( i == -1 ) {
        return answer = 0;
    }

    return answer = p(R, i) * solve(R, K - 1, i - 1) + (1 - p(R, i)) * solve(R, K, i - 1);
}

int main ( void ) {

    int n, k, e;
    std::cin >> n >> k >> e;

    double eps = 1.0 - e / 1000.0;

    int x0, y0;
    std::cin >> x0 >> y0;

    for ( int i = 0 ; i < n ; ++ i ) {
        int x, y;
        std::cin >> x >> y;
        bombs.emplace_back(bomb(x, y) - bomb(x0, y0));
    }

    double lo = 0;
    double hi = MAX_R;
    for ( int i = 0 ; i < 1000 && fabs(lo - hi) >= EPS ; ++ i ) {
        double r = (lo + hi) / 2;
        dp.clear();
        if ( solve(r, k, n-1) + EPS >= eps ) {
            hi = r;
        }
        else {
            lo = r;
        }
    }

    std::fixed(std::cout);
    std::cout.precision(16);
    std::cout << hi << std::endl;

    return 0;
}


#include <bits/stdc++.h>

using bomb = std::complex<long long>;

const int MAX_R = 3e3 + 3;
const int MAX_K = 2e2 + 2;
const long double EPS = 1e-10;

std::vector<bomb> bombs;
long double p ( const long double R , const int i ) {
    long double R2 = R*R;
    int d2 = std::norm(bombs[i]);

    if ( d2 <= R2 + EPS ) {
        return 1;
    }
    return exp(1.0 - d2 / R2);
}

std::unordered_map<int, long double> dp;
long double solve ( const long double R , const int K , const int i ) {
    const int idx = K + (i+1) * MAX_K;
    if ( dp.count(idx) ) {
        return dp[idx];
    }
    long double& answer = dp[idx];

    if ( K == 0 ) {
        return answer = 1;
    }
    if ( i == -1 ) {
        return answer = 0;
    }

    return answer = p(R, i) * solve(R, K - 1, i - 1) + (1 - p(R, i)) * solve(R, K, i - 1);
}

int main ( void ) {

    int n, k, e;
    std::cin >> n >> k >> e;

    long double eps = 1.0 - e / 1000.0;

    int x0, y0;
    std::cin >> x0 >> y0;

    for ( int i = 0 ; i < n ; ++ i ) {
        int x, y;
        std::cin >> x >> y;
        bombs.emplace_back(bomb(x, y) - bomb(x0, y0));
    }

    long double lo = 0;
    long double hi = MAX_R;
    for ( int i = 0 ; i < 1000 && fabs(lo - hi) >= EPS ; ++ i ) {
        long double r = (lo + hi) / 2;
        dp.clear();
        if ( solve(r, k, n-1) + EPS >= eps ) {
            hi = r;
        }
        else {
            lo = r;
        }
    }

    std::fixed(std::cout);
    std::cout.precision(16);
    std::cout << hi << std::endl;

    return 0;
}


#include <bits/stdc++.h>

using bomb = std::complex<long long>;

const int MAX_R = 1e3 + 3;
const int MAX_K = 1e2 + 2;
const double EPS = 1e-10;

std::vector<bomb> bombs;
double p ( const double R , const int i ) {
    double R2 = R*R;
    int d2 = std::norm(bombs[i]);

    if ( d2 <= R2 ) {
        return 1;
    }
    return exp(1 - d2 / R2);
}

std::unordered_map<int, double> dp;
double solve ( const double R , const int K , const int i ) {
    const int idx = K + i * MAX_K;
    if ( dp.count(idx) ) {
        return dp[idx];
    }
    double& answer = dp[idx];

    if ( K == 0 ) {
        return answer = 1;
    }
    if ( i == -1 ) {
        return answer = 0;
    }

    return answer = p(R, i) * solve(R, K - 1, i - 1) + (1 - p(R, i)) * solve(R, K, i - 1);
}

int main ( void ) {

    int n, k, e;
    std::cin >> n >> k >> e;

    double eps = 1.0 - e / 1000.0;

    int x0, y0;
    std::cin >> x0 >> y0;

    for ( int i = 0 ; i < n ; ++ i ) {
        int x, y;
        std::cin >> x >> y;
        bombs.emplace_back(bomb(x, y) - bomb(x0, y0));
    }

    double lo = 0;
    double hi = MAX_R;
    for ( int i = 0 ; i < 1000 && fabs(lo - hi) >= EPS ; ++ i ) {
        double r = (lo + hi) / 2;
        dp.clear();
        if ( solve(r, k, n-1) >= eps ) {
            hi = r;
        }
        else {
            lo = r;
        }
    }

    std::fixed(std::cout);
    std::cout.precision(16);
    std::cout << hi << std::endl;

    return 0;
}


#include <bits/stdc++.h>

using bomb = std::complex<long long>;

const int MAX_R = 1e3 + 3;
const int MAX_K = 1e2 + 2;
const double EPS = 1e-10;

std::vector<bomb> bombs;
double p ( const double R , const int i ) {
    double R2 = R*R;
    int d2 = std::norm(bombs[i]);

    if ( d2 + EPS <= R2 ) {
        return 1;
    }
    return exp(1.0 - d2 / R2);
}

std::unordered_map<int, double> dp;
double solve ( const double R , const int K , const int i ) {
    const int idx = K + (i+1) * MAX_K;
    if ( dp.count(idx) ) {
        return dp[idx];
    }
    double& answer = dp[idx];

    if ( K == 0 ) {
        return answer = 1;
    }
    if ( i == -1 ) {
        return answer = 0;
    }

    return answer = p(R, i) * solve(R, K - 1, i - 1) + (1 - p(R, i)) * solve(R, K, i - 1);
}

int main ( void ) {

    int n, k, e;
    std::cin >> n >> k >> e;

    double eps = 1.0 - e / 1000.0;

    int x0, y0;
    std::cin >> x0 >> y0;

    for ( int i = 0 ; i < n ; ++ i ) {
        int x, y;
        std::cin >> x >> y;
        bombs.emplace_back(bomb(x, y) - bomb(x0, y0));
    }

    double lo = 0;
    double hi = MAX_R;
    for ( int i = 0 ; i < 1000 && fabs(lo - hi) >= EPS ; ++ i ) {
        double r = (lo + hi) / 2;
        dp.clear();
        if ( solve(r, k, n-1) + EPS >= eps ) {
            hi = r;
        }
        else {
            lo = r;
        }
    }

    std::fixed(std::cout);
    std::cout.precision(16);
    std::cout << hi << std::endl;

    return 0;
}