#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

struct StronglyConnectedComponents{
    vector<int> used,cmp,vs;
    vector<vector<int>> v,rv;
    StronglyConnectedComponents(int n):used(n),cmp(n,-1),v(n),rv(n){}

    void add_edge(int x,int y){
        v[x].push_back(y);
        rv[y].push_back(x);
    }
    void dfs(int x){
        used[x]=true;
        for(auto to:v[x])if(!used[to])dfs(to);
        vs.push_back(x);
    }

    void rdfs(int x,int k){
        cmp[x]=k;
        for(auto to:rv[x])if(cmp[to]==-1)rdfs(to,k);
    }

    int scc(){
        rep(i,used.size())if(!used[i])dfs(i);
        reverse(vs.begin(),vs.end());
        int k=0;
        for(auto x:vs)if(cmp[x]==-1)rdfs(x,k++);
        return k;
    }
    void build(vector<vector<int>> &g){
        int k=scc();
        g.resize(k);
        set<pair<int,int>> used;
        rep(i,v.size()){
            for(auto& to:v[i]){
                int x=cmp[i],y=cmp[to];
                if(x==y||used.count({x,y}))continue;
                g[x].push_back(y);
                used.emplace(x,y);
            }
        }
    }
};

using Point  =complex<double>;
int main(){
    int n,m;
    cin>>n>>m;
    Point p[n][2];
    rep(i,n)rep(j,2){
        int x,y;
        cin>>x>>y;
        p[i][j]=Point(x,y);
    }
    Point f[m];
    rep(i,m){
        int x,y;
        cin>>x>>y;
        f[i]=Point(x,y);
    }
    double dist[m][m][1<<m];
    rep(i,m){
        rep(j,m)rep(k,1<<m)dist[i][j][k]=inf;
        dist[i][i][1<<i]=0;
        rep(j,1<<m){
            if((j&(1<<i))==0)continue;
            rep(k,m){
                if(((1<<k)&j)==0)continue;
                rep(l,m){
                    //if(k==l||k==i||l==i)continue;
                    if(((1<<l)&j)==0)continue;
                    dist[i][k][j]=min(dist[i][k][j],dist[i][l][j-(1<<k)]+abs(f[k]-f[l]));

                }
            }
        }
    }
    double d[n][n][2][2];
    rep(i,n)rep(j,n)rep(k,2)rep(l,2)d[i][j][k][l]=inf;
    rep(i,n)rep(j,n)rep(k,2)rep(l,2){
        if(i==j)continue;
        rep(x,m)rep(y,m){
            d[i][j][k][l]=min(d[i][j][k][l],abs(f[x]-p[i][k])+dist[x][y][(1<<m)-1]+abs(f[y]-p[j][l]));
        }
    }
    double ok=inf, ng=0;
    rep(_,60){
        double mid = (ok+ng)/2;
        StronglyConnectedComponents scc(2*n);
        rep(i,n)rep(j,n){
            if(i==j)continue;
            if(d[i][j][0][0]>mid){
                scc.add_edge(2*i, 2*j+1);
            }
            if(d[i][j][0][1]>mid){
                scc.add_edge(2*i, 2*j);
            }
            if(d[i][j][1][0]>mid){
                scc.add_edge(2*i+1, 2*j+1);
            }
            if(d[i][j][1][1]>mid){
                scc.add_edge(2*i+1, 2*j);
            }
            
        }
        scc.scc();
        bool can=true;
        rep(i,n){
            if(scc.cmp[2*i]==scc.cmp[2*i+1])can=false;
        }
        if(can)ok=mid;
        else ng=mid;
    }
    cout<<fixed<<setprecision(12)<<ok<<endl;
    return 0;
}


Measured memory_bytes: 63404