#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)

/* ?????¬????´? */
typedef complex<double> Point;  // Point
typedef vector<Point> VP;
const double EPS = 1e-6;    // ?¨±??????????????????????????£????????????

//?°???????x,y?????¨???????????°x,y??¨??????????????????????????§??§??????
#define X real()
#define Y imag()

// ?????????dot(a,b) = |a||b|cos??
double dot(Point a, Point b) {
  return a.X*b.X + a.Y*b.Y;
}

// ?????????cross(a,b) = |a||b|sin??
double cross(Point a, Point b) {
  return a.X*b.Y - a.Y*b.X;
}

// ??????????????????
int ccw(Point a, Point b, Point c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

// ???p?????´???a???????°???±????????????
Point proj(Point a1, Point a2, Point p) {
  return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1);
}

double distSP(Point a1, Point a2, Point p) {
  Point r = proj(a1, a2, p);
  if (!ccw(a1, a2, r)) return abs(r-p);
  return min(abs(a1-p), abs(a2-p));
}

// ??????????????????sort???max_element????????????
namespace std {
  bool operator<(const Point a, const Point b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}

// ??????
VP convexHull(VP& ps) {  // ????????????????????????????????????????????????VP&???
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  VP ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
    while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;  // ????¨?????????????????????? == -1 ??¨??????
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  ch.resize(k-1);
  return ch;
}

// ???????§???¢????????¨?????????O(n)
// ?????????????????¨??????1????¢?????????????2????????¨??????0?????????
int inConvex(Point p, const VP& ps) {
  int n = ps.size();
  int dir = ccw(ps[0], ps[1], p);
  rep (i, n) {
    int ccwc = ccw(ps[i], ps[(i + 1) % n], p);
    if (!ccwc) return 2;  // ?????????????????¨
    if (ccwc != dir) return 0;
  }
  return 1;
}

const double INF = 1e9;

#define cv_edge(CV,i) CV[i],CV[(i+1)%CV.size()]

int main(void){
    int N;
    while(cin>>N,N){
        vector<int> NV(N+2),H(N+2);
        vector<VP> ch(N+2,VP());
        rep(i,N){
            cin>>NV[i]>>H[i];
            ch[i] = VP(2*NV[i]);        
            rep(j,NV[i]){
                double x,y;
                cin>>x>>y;
                ch[i][j]={x,y};
            }
        }
        
        double theta,phi,sx,sy,tx,ty;
        cin>>theta>>phi>>sx>>sy>>tx>>ty;
        theta *= M_PI/180.0;
        phi   *= M_PI/180.0;

        rep(i,N){
            rep(j,NV[i]){
                ch[i][j+NV[i]] = ch[i][j] - polar(H[i]/tan(phi),theta);
            }
            ch[i] = convexHull(ch[i]);
        }

        N += 2;
        ch[N-1] = {{sx,sy}};
        ch[N-2] = {{tx,ty}};
    
        vector<vector<double>> d(N,vector<double>(N,INF));
        rep(i,N)rep(j,ch[i].size()){
            rep(k,N-2)rep(l,ch[k].size()){
                //??????i??????j??????????????????s,t?????¨ ??????k??????(l,l+1) ????????¢
                d[i][k] = d[k][i] = 
                    min(d[i][k],distSP(cv_edge(ch[k],l),ch[i][j]));
            }
            rep(k,N-2){
                //??????i??????j??????????????????s,t?????? ??????k????????¨?????????
                if(inConvex(ch[i][j], ch[k])){
                    d[i][k] = d[k][i] = 0;
                }
            }
        }

        rep(k,N)rep(i,N)rep(j,N)
            d[i][j] = min(d[i][j], d[i][k]+d[k][j]);

        printf("%.9f\n",min(d[N-1][N-2],abs(ch[N-1][0]-ch[N-2][0])));
    }
    return 0;
}

Measured memory_bytes: 3900