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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

typedef complex<double>Point;

int N,M;
Point A[222][2];

const double INF=1e18;
double dp[15][15][1<<15];
Point P[15];


namespace SCC{
    void visit(const vector<vector<int>>&G,vector<int>&vs,vector<int>&used,int v){
        used[v]=true;
        for(auto u:G[v]){
            if(!used[u])visit(G,vs,used,u);
        }
        vs.push_back(v);
    }

    void visit2(const vector<vector<int>>&T,vector<int>&used,vector<int>&comp,vector<int>&vec,int k,int v){
        comp[v]=k;
        used[v]=true;
        vec.push_back(v);

        for(auto u:T[v]){
            if(!used[u])visit2(T,used,comp,vec,k,u);
        }
    }

   void decompose(const vector<vector<int>>&G,vector<vector<int>>&H,vector<int>&comp){
        vector<vector<int>>T(G.size());
        for(int i=0;i<G.size();i++){
            for(auto v:G[i]){
                T[v].push_back(i);
            }
        }
        comp.resize(G.size());

        vector<int>vs(G.size());
        vector<int>used(G.size());
        for(int i=0;i<G.size();i++){
            if(!used[i])visit(G,vs,used,i);
        }
        reverse(vs.begin(),vs.end());
        fill(used.begin(),used.end(),0);

        int K=0;
        vector<vector<int>>S;
        for(auto v:vs){
            if(!used[v]){
                S.push_back(vector<int>());
                visit2(T,used,comp,S.back(),K++,v);
            }
        }

        H.resize(K);
        fill(used.begin(),used.end(),0);
        for(int i=0;i<K;i++){
            for(auto v:S[i]){
                for(auto u:G[v]){
                    if(used[comp[u]]||comp[v]==comp[u])continue;
                    used[comp[u]]=true;
                    H[comp[v]].push_back(comp[u]);
                }
            }
            for(auto v:H[i])used[v]=false;
        }

    }
}


double dist[200][2][200][2];

bool C(double d){
    vector<vint> G(2*N);
    rep(i,N){
        rep(j,N){
            if(i==j)continue;
            rep(k,2){
                rep(l,2){
                    if(dist[i][k][j][l]>d)G[i*2+k].pb(j*2+1-l),G[j*2+l].pb(i*2+1-k);
                }
            }
        }
    }

    vector<vint>H;
    vint comp;
    SCC::decompose(G,H,comp);

    rep(i,N)if(comp[i*2]==comp[i*2+1])return false;
    return true;
}

signed main(){
    cin>>N>>M;
    rep(i,N){
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        A[i][0]=Point(a,b);
        A[i][1]=Point(c,d);
    }


    rep(i,M){
        int a,b;
        cin>>a>>b;
        P[i]=Point(a,b);
    }

    fill_n(**dp,15*15*(1<<15),INF);

    rep(s,M){
        dp[s][s][1<<s]=0;

        rep(b,1<<M){
            rep(v,M){
                rep(u,M){
                    if(b>>u&1)continue;
                    chmin(dp[s][u][b|(1<<u)],dp[s][v][b]+abs(P[v]-P[u]));
                }
            }
        }
    }

    rep(i,N){
        rep(j,N){
            rep(k,2){
                rep(l,2){
                    double mi=INF;
                    rep(v,M)rep(u,M)chmin(mi,abs(P[v]-A[i][k])+dp[v][u][(1<<M)-1]+abs(A[j][l]-P[u]));
                    dist[i][k][j][l]=mi;
                }
            }
        }
    }


    double lb=0.0,ub=1e6;
    rep(i,50){
        double mid=(ub+lb)/2;
        if(C(mid))ub=mid;
        else lb=mid;
    }

    printf("%.20f\n",ub);
    return 0;

}

Measured memory_bytes: 68412