# Include <algorithm> # include <iostream> # include <cstring> # include <cstdlib> # include <fstream> # include <sstream> # include <vector> # include <string> # include <cstdio> # include <bitset> # include <stack> # include <queue> # include <cmath> # include <map> # include <set> # define FF (I, a, B) for (int I = a; I <B; I ++) # define FD (I, a, B) for (int I =; i> = B; I --) # define REP (I, n) for (int I = 0; I <n; I ++) # define CLR (a, B) memset (a, B, sizeo F (a) # define PB push_back # define LL long # define eps 1e-10 # define debug puts ("** debug **") using namespace std; struct Point {double x, y; Point (double x = 0, double y = 0): x (x), y (y) {}}; typedef Point Vector; vector operator + (Vector a, Vector B) {return Vector (. x + B. x,. y + B. y);} Vector operator-(Vector a, Vector B) {return Vector (. x-b.x,. y-b.y);} Vector operator * (Vector a, double p) {retu Rn Vector (. x * p,. y * p);} Vector operator/(Vector a, double p) {return Vector (. x/p,. y/p);} bool operator <(const Point & a, const Point & B) {return. x <B. x | (. x = B. x &. y <B. y);} int dcmp (double x) {if (fabs (x) <eps) return 0; return x <0? -1: 1;} bool operator = (const Point & a, const Point & B) {return dcmp (. x-b.x) = 0 & dcmp (. y-b.y) = 0;} double Dot (Vector a, Vector B) {return. x * B. x +. y * B. y;} double Length (Vector a) {return sqrt (Dot (a, a);} double Cross (Vector a, Vector B) {return. x * B. y-. y * B. x;} // If the Input Point is clockwise input, convert to the counterclockwise order void anticolockwise (Point * ch, int len) {for (int I = 0; I <len-2; I ++) {double tmp = Cross (ch [I]-ch [I + 2], ch [I + 1]-ch [I + 2]); if (tmp> eps) return; else if (tmp <-eps) {reverse (ch, ch + len); return ;}}} // distance from Point p to line AB double DistanceToSegment (Point p, Point a, Point B) {if (a = B) return Length (p-); vector v1 = B-a, v2 = p-a, v3 = p-B; if (dcmp (Dot (v1, v2) <0) return Length (v2 ); else if (dcmp (Dot (v1, v3)> 0) return Length (v3); else return fabs (Cross (v1, v2)/Length (v1 );} double dis_pair_seg (Point p1, Point p2, Point p3, Point p4) {return min (DistanceToSegment (p1, p3, p4), DistanceToSegment (p2, p3, p4 )), min (DistanceToSegment (p3, p1, p2), DistanceToSegment (p4, p1, p2);} double RC_Distance (Point * hour, Point * ch2, int n, int m) {int q = 0, p = 0; REP (I, n) if (distinct [I]. y-ch1 [p]. y <-eps) p = I; REP (I, m) if (ch2 [I]. y-ch2 [q]. y> eps) q = I; Listen [n] = Listen [0]; ch2 [m] = ch2 [0]; double tmp, ans = 1e100; REP (I, n) {while (tmp = Cross (Values [p + 1]-Values [p], ch2 [q + 1]-Values [p]) -Cross (pipeline [p + 1]-pipeline [p], ch2 [q]-pipeline [p])> eps) q = (q + 1) % m; if (tmp <-eps) ans = min (ans, DistanceToSegment (ch2 [q], period [p], period [p + 1]); else ans = min (ans, dis_pair_seg (period [p], period [p + 1], ch2 [q], ch2 [q + 1]); p = (p + 1) % n;} return ans;} int n, m; Point latency [10001], ch2 [10001]; int main () {while (scanf ("% d", & n, & m), n + m) {REP (I, n) scanf ("% lf ", & images [I]. x, & images [I]. y); REP (I, m) scanf ("% lf", & ch2 [I]. x, & ch2 [I]. y); printf ("%. 5f \ n ", min (RC_Distance (distance, ch2, n, m), RC_Distance (ch2, distance, m, n);} return 0 ;}