#include using namespace std; using ll = long long; // vector OA = (x, y) template struct vec{ T x, y; vec (T xx=0, T yy=0) : x(xx), y(yy) {}; vec operator-() const { return vec(-x, -y); } vec& operator+=(const vec &w) { x += w.x; y += w.y; return *this; } vec& operator-=(const vec &w) { x -= w.x; y -= w.y; return *this; } vec operator+(const vec &w) const { vec res(*this); return res += w; } vec operator-(const vec &w) const { vec res(*this); return res-=w; } }; //Inner product of vectors v and w template T dot(vec v, vec w){ return v.x * w.x + v.y * w.y; } //Outer product of vector v and w template T outer(vec v, vec w){ return v.x * w.y - w.x * v.y; } //size of triangle ABC template T heron(vec &a, vec &b, vec &c){ return abs(outer(b-a, c-a)) / 2; } //Distance between point a and b template T distance(vec &a, vec &b){ return sqrt(dot(a-b, a-b)); } //Convex Hull(Smallest Convex set containing all given vecs) //Grahum Scan (O(NlogN)) template vector> convex_hull(vector> P){ sort(P.begin(), P.end(), [](vec &p1, vec &p2) { if (p1.x != p2.x) return p1.x < p2.x; return p1.y < p2.y; }); int N=P.size(), k=0, t; vector> res(N*2); for (int i=0; i 1 && outer(res[k-1]-res[k-2], P[i]-res[k-1]) <= 0) k--; res[k] = P[i]; k++; } t = k; for (int i=N-2; i>=0; i--){ while(k > t && outer(res[k-1]-res[k-2], P[i]-res[k-1]) <= 0) k--; res[k] = P[i]; k++; } res.resize(k-1); return res; } //distance between line PQ and point R template T dist_line_point(vec &p, vec &q, vec &r){ // ax+by+c=0 T a = (q.y-p.y), b = (p.x-q.x), c = -p.x*q.y + p.y*q.x; cout << a << " " << b << " " << c << endl; return abs(a*r.x+b*r.y+c) / sqrt(a*a+b*b); }; //judge if line AB intersects line CD template bool intersect(vec &a, vec &b, vec &c, vec &d){ T s1, t1, s2, t2; s1 = outer(b-a, c-a); t1 = outer(b-a, d-a); s2 = outer(d-c, a-c); t2 = outer(d-c, b-c); if (s1 * t1 < 0 && s2 * t2 < 0) return 1; return 0; } int main(){ using ld = long double; ll N, Q, a, b, c, d; cin >> N >> Q; ld x, y; vector> q(N*2); vector> dist(N*2, vector(N*2, 1e18)); for (int i=0; i> x >> y; q[i] = vec(x, y); } for (int i=0; i> a >> b >> c >> d; a--; b--; c--; d--; cout << setprecision(18) << dist[a*2+b][c*2+d] << endl; } return 0; }