#include<bits/stdc++.h>
#define MAX 110
#define inf (1e9)
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-15)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pld(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

class Point{
public:
  double x,y;
  Point(double x=0,double y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ 
    return equals(x,p.x) ? y-p.y<-eps : x-p.x<-eps; }
  bool operator==(Point p)const{ 
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):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 intersect(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 intersect(Segment s1,Segment s2){
  return intersect(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)<eps)return abs(p-s.p1);
  if(dot(s.p1-s.p2,p-s.p2)<eps)return abs(p-s.p2);
  return getDistanceLP(s,p);
}

double getDistance(Segment s1,Segment s2){
  if(intersect(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 convex_hull(Polygon s){
  Polygon g;
  int n=s.size();
  if(n<3)return s;

  sort(s.begin(),s.end());

  for(int i=0;i<n;i++){
    for(int n=g.size();n>=2&&ccw(g[n-2],g[n-1],s[i])==1;n--){
      g.pop_back();
    }
    g.push_back(s[i]);
  }
  for(int i=n-2;i>=0;i--){
    for(int n=g.size();n>=2&&ccw(g[n-2],g[n-1],s[i])==1;n--){
      g.pop_back();
    }
    g.push_back(s[i]);
  }
  reverse(g.begin(),g.end());
  g.pop_back();
  return g;
}

int contains(Polygon g,Point p){
  int n=g.size();
  bool x=false;
  for(int i=0;i<n;i++){
    Vector a=g[i]-p,b=g[(i+1)%n]-p;
    if(abs(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;
  }
  if(x)return 2;
  return 0;
}

int n;
Polygon P[MAX];
double h[MAX];
double a,b;
Point s,t;
vector<pid> e[MAX];

void init(){
  FOR(i,0,MAX){
    e[i].clear();
    P[i].clear();
  }
}

void add_edge(int from,int to,double cost){
  e[from].pb(mp(to,cost));
  e[to].pb(mp(from,cost));
}

double dijkstra(){
  priority_queue<pdi,vector<pdi>,greater<pdi> > pq;
  double d[MAX];
  fill(d,d+MAX,inf);
  d[n]=0;
  pq.push(mp(0,n));

  while(pq.size()){
    pdi u=pq.top();
    pq.pop();

    if(d[u.s]-u.f<-eps)continue;
    if(u.s==n+1)return d[u.s];

    FOR(i,0,e[u.s].size()){
      int next=e[u.s][i].f;
      double cost=d[u.s]+e[u.s][i].s;
      if(cost-d[next]<-eps){
        d[next]=cost;
        pq.push(mp(cost,next));
      }
    }
  }
  return d[n+1];
}

double getdis(int i,int j){
  double dis=inf;
  int size1=P[i].size();
  int size2=P[j].size();
  FOR(k,0,size1)
    if(contains(P[j],P[i][k])!=0)return 0.0;
  FOR(l,0,size2)
    if(contains(P[i],P[j][l])!=0)return 0.0;
  FOR(k,0,size1){
    Segment seg1(P[i][k],P[i][(k+1)%size1]);
    FOR(l,0,size2){
      Segment seg2(P[j][l],P[j][(l+1)%size2]);
      dis=min(dis,getDistance(seg1,seg2));
    }
  }
  return dis;
}

double getdis(int i,Point p){
  if(contains(P[i],p)!=0)return 0.0;
  double dis=inf;
  int m=P[i].size();
  FOR(j,0,m){
    Segment seg(P[i][j],P[i][(j+1)%m]);
    dis=min(dis,getDistanceSP(seg,p));
  }
  return dis;
}

double solve(){
  FOR(i,0,n){
    double dis=h[i]/tan(b*pi/180.0);
    Vector v=Point(-cos(a*pi/180.0),-sin(a*pi/180.0));
    v=v*dis;
    Polygon temp=P[i];
    FOR(j,0,P[i].size())temp.pb(P[i][j]+v);
    P[i]=convex_hull(temp);
  }
  FOR(i,0,n)
    FOR(j,i+1,n)
      add_edge(i,j,getdis(i,j));

  FOR(i,0,n){
    add_edge(n,i,getdis(i,s));
    add_edge(n+1,i,getdis(i,t));
  }
  add_edge(n,n+1,abs(s-t));
  return dijkstra();
}

int main()
{
  while(cin>>n && n){
    init();
    FOR(i,0,n){
      Polygon p;
      int N;
      cin>>N>>h[i];
      FOR(j,0,N){
        int x,y;
        cin>>x>>y;
        p.pb(Point(x,y));
      }
      P[i]=p;
    }
    cin>>a>>b;
    cin>>s.x>>s.y>>t.x>>t.y;
    pd(solve());
  }
  return 0;
}

Measured memory_bytes: 3884