#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef complex<double> V;
typedef vector<P> vecP;
typedef pair<P,P> L;
typedef pair<P,P> S;
typedef pair<P,double> C;
const double eps=1e-8;
const double PI=acos(-1);
const double PI2=PI*2.0;
 
namespace std{
  bool operator < (const P &a,const P &b){
    return (a.real()!=b.real()?
            a.real() <b.real():
            a.imag() <b.imag());
  }
};
 
V normal(V a){
  assert( abs(a)>0 );
  return a/abs(a);
}
 
double Sqrt( double x ){
  if(x<0)return 0;
  else return sqrt(x);
}
 
P Vector(L a){
  return a.second-a.first;
}
 
bool eq(double a,double b){
  return (-eps<a-b&&a-b<eps);
}
 
bool eq(P a,P b){
  return ( eq(a.real(),b.real()) && eq(a.imag(),b.imag()) );
}
 
double dot(P a,P b){
  return real(b*conj(a));
}
 
double cross(P a,P b){
  return imag(b*conj(a));
}
 
double getArg(P a,P b){
  return arg(b*conj(a));
}
 
double getTime(V a,V b){
  assert( eq(cross(a,b),0) );
  return ( dot(a,b) < 0 ? -1.0 : 1.0 ) * abs(b) / abs(a);
}
 
 
P project(P a,P b,P c){
  b-=a,c-=a;
  return a+b*real(c/b);
}
 
P reflect(P a,P b,P c){
  b-=a,c-=a;
  return a+b*conj(c/b);
}
 
int ccw(P a,P b,P c){
  P ab=b-a,ac=c-a;
  P k=ac*conj(ab);
  if(k.imag()>0)return 1;
  if(k.imag()<0)return -1;
  if(k.real()<0)return 2;
  if(abs(ab)<abs(ac))return -2;
  return 0;
}
 
bool isParallel(P a,P b){
  return eq(0, cross(a,b));
}
 
bool isParallel(S a,S b){
  return eq(0, cross( Vector(a) , Vector(b) ) );
}
 
bool onLP(L l,P p){
  P a=l.first, b=l.second;
  return eq(0, cross(b-a,p-a));
}
 
bool onSP(S s,P p){
  P a=s.first, b=s.second;
  return eq( abs(b-a) , abs(a-p)+abs(b-p) );
}
 
bool isCrossSS(S s0,S s1){
  P a=s0.first, b=s0.second;
  P c=s1.first, d=s1.second;
  int f0 = ccw(a,b,c) * ccw(a,b,d);
  int f1 = ccw(c,d,a) * ccw(c,d,b);
  return (f0<=0 && f1<=0);
}
 
bool isCrossLS(L l,S s){
  P a=l.first, b=l.second;
  P c=s.first, d=s.second;
  return ( ccw(a,b,c) * ccw(a,b,d) <= 0 );
}
 
double distLP(L l,P p){
  P a=l.first, b=l.second;
  double res = cross(b-a,p-a) / abs(b-a);
  return abs(res);
}
 
double distSP(S s,P p){
  P a=s.first, b=s.second;
  if( dot(b-a,p-a) < eps )return abs(p-a);
  if( dot(a-b,p-b) < eps )return abs(p-b);
  return distLP(s,p);
}
 
double distSS(S s0,S s1){
  if( isCrossSS(s0,s1) )return 0;
  double res0 = min( distSP( s0, s1.first ) , distSP(s0, s1.second) );
  double res1 = min( distSP( s1, s0.first ) , distSP(s1, s0.second) );
  return min(res0,res1);
}
 
P getCrossLL(L l0,L l1){
  P a=l0.first, b=l0.second;
  P c=l1.first, d=l1.second;
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}
 
 
  
int inPolygon(vecP &t,P p){
  int n=t.size();
  double sum=0;
  for(int i=0;i<n;i++){
    P a=t[i],b=t[(i+1==n?0:i+1)];
    if( ccw(a,b,p)==0 )return 1;
    sum+= getArg(a-p,b-p);
  }
  if( abs(sum) < eps )return 0;
  else return 2;
}
 
vecP andrewScan(vecP &t){
  int N=t.size(),C=0;
  vecP R(N);
  for(int i=0;i<N;i++){
    while(2<=C&&ccw(R[C-2],R[C-1],t[i])==-1)C--;
    R[C++]=t[i];
  }
  vecP res(C);
  for(int i=0;i<C;i++)res[i]=R[i];
  return res;
}
  
vecP convexHull(vecP &t){
  sort(t.begin(),t.end());
  vecP u=andrewScan(t);
  reverse(t.begin(),t.end());
  vecP l=andrewScan(t);
  for(int i=1;i+1<(int)l.size();i++)u.push_back(l[i]);
  return u;
}
 
S getS(vecP &t,int id){
  int n=t.size();
  return S(t[id%n],t[(id+1)%n]);
}

int N;
vecP A[100];
int H[100];
double dir;
double inr;
double G[100][100];

double calc(int from,int to){
  if( inPolygon(A[from],A[to][0]) )return 0.0;
  if( inPolygon(A[to], A[from][0]) )return 0.0;

  double res=1e9;
  for(int i=0;i<(int)A[from].size();i++){
    S s0=getS(A[from],i);
    for(int j=0;j<(int)A[to].size();j++){
      S s1=getS(A[to],j);
      res=min(res, distSS(s0,s1) );
    }
  }
  return res;
}

double calcDist(vecP &t,P p){
  if(inPolygon(t,p))return 0.0;
  double res=1e9;
  for(int i=0;i<(int)t.size();i++){
    S s=getS(t,i);
    res=min(res, distSP(s,p) );
  }
  return res;
}

double change(double x){
  return x/360.0 * 2.0*PI;
}

int main(){
  while(1){
    cin>>N;
    if(N==0)break;
    for(int i=0;i<N;i++){
      A[i].clear();
      int v;
      cin>>v>>H[i];
      A[i].resize(v);
      for(int j=0;j<v;j++){
        int x,y;
        cin>>x>>y;
        A[i][j]=P(x,y);
      }
    }
    cin>>dir>>inr;
    dir=change(dir);
    inr=change(inr);
    
    P base=P( -cos(dir), -sin(dir) );
    for(int i=0;i<N;i++){
      int size=A[i].size();
      // R*sin(inr)=H
      double height=H[i];
      double R=height/sin(inr);
      double W=Sqrt(R*R-height*height);
      P v=base*W;
      for(int j=0;j<size;j++){
        P np=A[i][j]+v;
        A[i].push_back(np);
      }
      A[i]=convexHull(A[i]);
    }
    for(int i=0;i<N;i++){
      for(int j=0;j<N;j++){
        if(i==j)G[i][j]=0;
        else G[i][j]=calc(i,j);
      }
    }

    for(int k=0;k<N;k++)
      for(int i=0;i<N;i++)
        for(int j=0;j<N;j++)
          G[i][j]=min(G[i][j],G[i][k]+G[k][j]);

    P si,ti;
    int x,y;
    cin>>x>>y;
    si=P(x,y);
    
    cin>>x>>y;
    ti=P(x,y);
    double ans= abs(si-ti);
    for(int i=0;i<N;i++)
      for(int j=0;j<N;j++)
        ans=min( ans, calcDist(A[i],si) + calcDist(A[j],ti) + G[i][j] );

    printf("%.10f\n",ans);
    
  }
  return 0;
  
}