#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<complex>
#include<utility>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define ALL(C)     (C).begin(),(C).end()
#define mp         make_pair
#define pb         push_back

typedef complex<double>     P;
typedef pair<P,P>           Line;
typedef pair<double,double> pdd;

const double eps = 1e-10;
const double INF = 10000;

double cross(P a,P b){
  return a.real()*b.imag()-a.imag()*b.real();
}

double dot(P a,P b){
  return a.real()*b.real()+a.imag()*b.imag();
}

double isp(P a,P b,P c){
  return abs(a-c)+abs(b-c) < abs(a-b)+eps;
}

double distance_ls_p(P &a,P &b,P &c){
  if (dot(b-a,c-a) < eps)return abs(c-a);
  if (dot(a-b,c-b) < eps)return abs(c-b);
  return abs(cross(b-a,c-a))/abs(b-a);
}

#define D distance_ls_p
double distance_ss_p(P a,P b,P c,P d){
  return min(  min( D(a,b,c),D(a,b,d)),min(D(c,d,a),D(c,d,b)));
}

bool is_intersected_ls(P a1,P a2,P b1,P b2){
  if ( isp(a1,a2,b1))return true;
  if ( isp(a1,a2,b2))return true;
  if ( isp(b1,b2,a1))return true;
  if ( isp(b1,b2,a2))return true;
  if (  ( cross(a2-a1,b1-a1) * cross(a2-a1,b2-a1)<-eps ) && 
	( cross(b2-b1,a1-b1)*cross(b2-b1,a2-b1)<-eps))return true;
  else return false;
}


double tri_search(double left,double right,Line &a,P &b){
  double mleft,mright;
  while(left < right){
    mleft =(right  +2*left)/3;
    mright=(right*2+  left)/3;
    P tb(b.real(),b.imag());
    tb.real()=b.real()+mleft;
    double ldist=distance_ls_p(a.first,a.second,tb);
    tb.real()=b.real()+mright;
    double rdist=distance_ls_p(a.first,a.second,tb);
    if (rdist > ldist){
      right=mright-eps;
    }else {
      left=mleft+eps;
    }    
  }  
  return (right+left)/2;
}

double bsearch(double left,double right,Line &a,P &b,double L){
  double mid=0;
  rep(i,250){
    mid = (left+right)/2;
    P tb(b.real(),b.imag());
    tb.real()=b.real()+mid;
    double dist=distance_ls_p(a.first,a.second,tb);
    if (dist <L){
      left=mid+eps;
    }else {
      right=mid-eps;
    }
  }
  return mid;
}

pdd find_L(Line &a,P &b,double L){
  if (a.first.imag() == a.second.imag()){
    double l = bsearch(min(a.first.real(),a.second.real()),-INF,a,b,L);
    double r = bsearch(max(a.first.real(),a.second.real()), INF,a,b,L);    
    return mp(l,r);
  }else {
    double mid = tri_search(-INF,INF,a,b);
    double l=bsearch(mid,-INF,a,b,L);
    double r=bsearch(mid,INF,a,b,L);
    return mp(l,r);
  }
}

pdd get_L(Line &a,P &b,double L){
  pdd Lpoint=find_L(a,b,L);
  return Lpoint;
}

void find_Ldif(Line a,Line b,double L,vector<double> &ret,vector<double>&ret2){
  pdd cand[4];
  cand[0]=get_L(a,b.first,L);
  cand[1]=get_L(a,b.second,L);
  cand[2]=get_L(b,a.first,L);
  cand[3]=get_L(b,a.second,L);
  
  rep(i,2){
    if (cand[i].first < -INF+1 || cand[i].first > INF-1);
    else ret.pb(cand[i].first);
    if (cand[i].second < -INF+1 || cand[i].second > INF-1);
    else ret.pb(cand[i].second);
  }

  REP(i,2,4){
    if (cand[i].first < -INF+1 || cand[i].first > INF-1);
    else ret2.pb(cand[i].first);
    if (cand[i].second < -INF+1 || cand[i].second > INF-1);
    else ret2.pb(cand[i].second);
  }
}

bool is_in(vector<P> &in,P a){
  int cnt=0;
  int n = in.size();
  rep(i,n){
    P cur = in[i]-a,next=in[(i+1)%n]-a;
    if (cur.imag() > next.imag())swap(cur,next);
    if (cur.imag()<0 && 0<=next.imag() &&
	cross(next,cur)>=0)cnt++;
    if (isp(in[i],in[(i+1)%n],a))return true;
  }
  if (cnt%2 == 1)return true;
  else return false;
}

bool isok(vector<P> &va,vector<P> &vb,double L){
  rep(i,va.size()){
    rep(j,vb.size()){
      double tmp = distance_ss_p(va[i],va[(i+1)%va.size()],vb[j],vb[(j+1)%vb.size()]);
      if (tmp+eps < L){
	return false;
      }
    }
  }

  rep(i,vb.size()){
    if (is_in(va,vb[i]))return false;
  }

  rep(i,va.size()){
    if (is_in(vb,va[i]))return false;
  }

  rep(i,va.size()){
    rep(j,vb.size()){
      if (is_intersected_ls(va[i],va[(i+1)%va.size()],vb[j],vb[(j+1)%vb.size()]))return false;
    }
  }

  return true;
}

double compute_width(vector<P> &va,vector<P> &vb){
  double maxi=-INF,mini=INF;
  rep(i,va.size()){
    maxi=max(va[i].real(),maxi);
    mini=min(va[i].real(),mini);
  }
  rep(i,vb.size()){
    maxi=max(vb[i].real(),maxi);
    mini=min(vb[i].real(),mini);
  }
  return maxi-mini;
}

double solve(vector<P> &va,vector<P> vb,vector<double> &cand,double L){
  double ans =1e10;

  rep(i,cand.size()){
    rep(j,vb.size())vb[j].real()+=cand[i];
    if (isok(va,vb,L) ){
      ans=min(ans,compute_width(va,vb));
    }
    rep(j,vb.size())vb[j].real()-=cand[i];
  }
  return ans;
}


main(){
  double L;
  while(cin>>L && L){
    vector<P> va,vb;
    P a;
    int n;
    cin>>n;
    rep(i,n){
      cin>>a.real()>>a.imag();
      va.pb(a);
    }
    
    int m;
    cin>>m;
    rep(i,m){
      cin>>a.real()>>a.imag();
      vb.pb(a);
    }

    vector<double> cand_a;
    vector<double> cand_b;
    rep(i,va.size()){
      rep(j,vb.size()){
	find_Ldif(mp(va[i],va[(i+1)%va.size()]),mp(vb[j],vb[(j+1)%vb.size()]),L,cand_a,cand_b);
      }
    }
    
    double ans =min(solve(va,vb,cand_a,L),solve(vb,va,cand_b,L));
    printf("%.8lf\n",ans);
  }
  
  return false;
}

Measured memory_bytes: 1024