#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#define EPS (1e-10)
#define PI 3.141592653589793238
struct Point{
  double x,y;
  Point(){}
  Point(double x,double y):x(x),y(y){}
  Point operator+(Point a){return Point(x+a.x,y+a.y);}
  Point operator-(Point a){return Point(x-a.x,y-a.y);}
  Point operator*(double k){return Point(x*k,y*k);}
  Point operator/(double k){return Point(x/k,y/k);}
  double norm(){return x*x+y*y;}
  bool operator<(const Point &p)const{
    return x!=p.x?x<p.x:y<p.y;
  }
};
typedef Point Vector;
typedef vector<Point> Polygon;

struct Segment {
  Point p1, p2;
  Segment(){}
  Segment(Point p1, Point p2):p1(p1), p2(p2){}
};
typedef Segment Line;

double norm(Vector a) {
  return a.x*a.x+a.y*a.y;
}
double abs(Vector a) {
  return sqrt(norm(a));
}
double dot(Vector a, Vector b) {
  return a.x*b.x+a.y*b.y;
}

double cross(Vector a, Vector b) {
  return a.x*b.y-a.y*b.x;
}

Int ccw(Point p0,Point p1,Point p2){
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if(cross(a,b) > EPS) return 1;
  if(cross(a,b) < -EPS) return -1;
  if(dot(a,b) < -EPS) return 2;
  if(a.norm() < b.norm()) return -2;
  return 0;
}

bool intersectSS(Point p1,Point p2,Point p3,Point p4){
  return (ccw(p1,p2,p3) * ccw(p1,p2,p4)<= 0 &&
          ccw(p3,p4,p1) * ccw(p3,p4,p2)<= 0);
}

bool intersectSS(Segment s1, Segment s2) {
  return intersectSS(s1.p1, s1.p2, s2.p1, s2.p2);
}

double getDistanceLP(Line l, Point p) {
  return abs(cross(l.p2-l.p1, p-l.p1)/abs(l.p2-l.p1));
}

double getDistanceSP(Segment s, Point p) {
  if(dot(s.p2-s.p1, p-s.p1) < 0.0) return abs(p-s.p1);
  if(dot(s.p1-s.p2, p-s.p2) < 0.0) return abs(p-s.p2);
  return getDistanceLP(s, p);
}

double getDistanceSS(Segment s1, Segment s2) {
  if(intersectSS(s1, s2)) return 0.0;
  return min(min(getDistanceSP(s1, s2.p1), getDistanceSP(s1, s2.p2)),
             min(getDistanceSP(s2, s1.p1), getDistanceSP(s2, s1.p2)));
}

Polygon andrewScan(Polygon s){
  Polygon u,l;
  if(s.size() < 3) return s;
  sort(s.begin(),s.end());
  u.push_back(s[0]);
  u.push_back(s[1]);
  l.push_back(s[s.size()-1]);
  l.push_back(s[s.size()-2]);
  //puts("OK");
  for(Int i=2;i<(Int)s.size();i++){
    for(Int n=u.size();n>=2 && ccw(u[n-2],u[n-1],s[i]) != -1;n--){
      u.pop_back();
    }
    u.push_back(s[i]);
  }
  // puts("OK2");
  for(Int i=s.size()-3;i>=0;i--){
    for(Int n=l.size(); n>=2 && ccw(l[n-2],l[n-1],s[i])!= -1; n--){
      l.pop_back();
    }
    l.push_back(s[i]);
  }
  //puts("OK3");
  reverse(l.begin(),l.end());
  for(Int i=u.size()-2;i>=1;i--) l.push_back(u[i]);
  //puts("OK4");
  return l;
}

Vector translate(Vector v,double theta){
  Vector res;
  res.x = cos(theta) * v.x - sin(theta) * v.y;
  res.y = sin(theta) * v.x + cos(theta) * v.y;
  return res;
}

double getDistancePoP(Polygon p,Point q){
  double res=abs(p[0]-q);
  for(Int i=0;i<(Int)p.size();i++){
    Segment s(p[i],p[(i+1)%p.size()]);
    res=min(res,getDistanceSP(s,q));
  }
  return res;
}
double getDistancePoPo(Polygon p,Polygon q){
  double res=abs(p[0]-q[0]);
  for(Int i=0;i<(Int)p.size();i++){
    Segment s(p[i],p[(i+1)%p.size()]);
    for(Int j=0;j<(Int)q.size();j++){
      Segment t(q[j],q[(j+1)%q.size()]);
      res=min(res,getDistanceSS(s,t));
    }
  }
  //cout<<res<<endl;
  return res;
}


Int contains(Polygon g,Point p){
  Int n=g.size();
  bool x=0;
  for(Int i=0;i<n;i++){
    Point a=g[i]-p,b=g[(i+1)%n]-p;
    if(fabs(cross(a,b))<EPS&&dot(a,b)<EPS) return 1;
    if(a.y>b.y) swap(a,b);
    if(a.y<EPS&&EPS<b.y&&cross(a,b)>EPS) x=!x;
  }
  return (x?2:0);
}

signed main(){
  Int n;
  while(cin>>n,n){
    Polygon p[n];
    Int nv[n];
    double h[n];
    for(Int i=0;i<n;i++){
      cin>>nv[i]>>h[i];
      p[i].resize(nv[i]*2);
      for(Int j=0;j<nv[i];j++) cin>>p[i][j].x>>p[i][j].y;
    }
    double th,phi;
    cin>>th>>phi;
    for(Int i=0;i<n;i++){
      Vector dif(h[i]/tan(PI/180*phi),0);
      dif=translate(dif,PI/180*(th+180));
      //cout<<nv[i]<<" "<<p[i].size()<<endl;
      for(Int j=0;j<nv[i];j++) p[i][j+nv[i]]=p[i][j]+dif;
      //cout<<dif.x<<" "<<dif.y<<endl;
      p[i]=andrewScan(p[i]);
    }
    Point s,t;
    cin>>s.x>>s.y>>t.x>>t.y;
    //cout<<s.x<<" "<<s.y<<" "<<t.x<<" "<<t.y<<endl;
    double inf=1e9;
    vector<Int> used(n+2,0);
    vector<double> dist(n+2,inf);

    vector<vector<double> > e(n+2,vector<double>(n+2,inf));
    for(Int i=0;i<n;i++){
      for(Int j=0;j<n;j++){
        e[i][j]=getDistancePoPo(p[i],p[j]);
      }
      e[n][i]=getDistancePoP(p[i],s);
      if(contains(p[i],s)!=0) e[n][i]=0;
      e[i][n+1]=getDistancePoP(p[i],t);
      if(contains(p[i],t)!=0) e[i][n+1]=0;
    }
    e[n][n+1]=abs(s-t);
    dist[n]=0;
    for(Int i=0;i<n+2;i++){
      Int v=-1;
      for(Int j=0;j<n+2;j++){
        if(dist[j]==inf||used[j]) continue;
        if(v<0||dist[j]<dist[v]) v=j;
      }
      if(v<0) break;
      //cout<<v<<" "<<dist[v]<<endl;
      used[v]=1;
      for(Int j=0;j<n+2;j++){
        if(v==j) continue;
        dist[j]=min(dist[j],dist[v]+e[v][j]);
      }
    }
    
    printf("%.10f\n",dist[n+1]);
  }
  return 0;
}



Measured memory_bytes: 3836