#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 1010

typedef double P_type;
typedef complex<P_type> P;
const P_type P_eps = 1e-8; //??´??°???????????????

namespace std{
  template<class T> bool operator<(const complex<T> &a, const complex<T> &b){
    return a.real() == b.real() ? a.imag() < b.imag() : a.real() < b.real();
  }
};


P rotate(P p, double theta){
  return p * P(cos(theta), sin(theta));
}

//??????
double dot(P a, P b) {
  return (a * conj(b)).real();
}

//??????
double cross(P a, P b) {
  return (a * conj(b)).imag();
}

//???????¨???????
int ccw(P a, P b, P c){
  if(cross(b-a,c-a) > P_eps) return 1; //COUNTER_CLOCKWISE
  if(cross(b-a,c-a) < -P_eps) return -1; //CLOCKWISE
  if(dot(b-a,c-a) < P_eps) return -2; //c -> a -> b
  if(dot(a-b,c-b) < P_eps) return 2; //a -> b -> c
  return 0; //a -> c -> b
}

/* ??????ab??¨???c????????¢ */
double distanceSP(P a, P b, P c) {
  if ( dot(b-a, c-a) < P_eps ) return abs(c-a);
  if ( dot(a-b, c-b) < P_eps ) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}

bool iscontained(vector<P> &g, P p){
  int n = g.size();
  bool f = false;
  for(int i=0;i<n;i++){
    P a = g[i] - p, b = g[(i+1)%n] - p;
    if(abs(cross(a,b)) < P_eps && dot(a,b) < P_eps) return true;
    if(a.imag() > b.imag()) swap(a,b);
    if(a.imag() < P_eps && P_eps < b.imag() && cross(a,b) > P_eps) f = !f;
  }
  return f;
}

/* ConvexHull(??????) */

vector<P> ConvexHull(vector<P> s){
  vector<P> g;
  int n = (int)s.size();
  
  if(n<3) return s;
  
  sort(s.begin(),s.end());
  
  for(int i=0;i<n;i++){
    for(int m = (int)g.size();m>=2 && ccw(g[m-2],g[m-1],s[i]) != -1; m--){
      g.pop_back();
    }
    g.push_back(s[i]);
  }
  
  int t = (int)g.size();
  
  for(int i=n-2;i>=0;i--){
    for(int m = (int)g.size();m>t && ccw(g[m-2],g[m-1],s[i]) != -1; m--){
      g.pop_back();
    }
    g.push_back(s[i]);
  }
  
  reverse(g.begin(),g.end());
  g.pop_back();
  
  return g;
}


bool solve(){  
  int n;
  int h[SIZE];
  int theta, phi;
  int sx,sy,gx,gy;
  vector<P> shade[1000];
  vector<P> points[1000];
  
  scanf("%d",&n);
  
  if(n == 0) return false;
  
  for(int i=0;i<n;i++){
    int nv;
    scanf("%d%d",&nv,h+i);
    
    for(int j=0;j<nv;j++){
      int x,y;
      scanf("%d%d",&x,&y);
      points[i].push_back(P(x,y));
    }
  }

  scanf("%d%d",&theta, &phi);
  scanf("%d%d%d%d",&sx,&sy,&gx,&gy);

  P start(sx,sy), goal(gx,gy);
  
  for(int i=0;i<n;i++){

    double dist_sa = h[i] / tan(phi / 180.0 * M_PI); 
    P sa = P(cos((theta + 180) / 180.0 * M_PI), sin((theta + 180) / 180.0 * M_PI));
    sa *= dist_sa;
    
    int m = points[i].size();
    
    for(int j=0;j<m;j++){

      P sp = sa + points[i][j];
      
      points[i].push_back(sp);
    }
  }
  
  for(int i=0;i<n;i++){
    shade[i] = ConvexHull(points[i]);
  }
  shade[n].push_back(start);
  shade[n+1].push_back(goal);
  
  double dist[SIZE][SIZE];

  for(int i=0;i<n+2;i++){
    for(int j=0;j<n+2;j++){
      dist[i][j] = 1e18;
    }
  }
  
  for(int i=0;i<n+2;i++){
    int m = shade[i].size();

    for(int j=0;j<n+2;j++){
      for(int k=0;k<shade[i].size();k++){
        for(int l=0;l<shade[j].size();l++){
          double res = distanceSP(shade[i][k],shade[i][(k+1)%m],shade[j][l]);
          dist[i][j] = dist[j][i] = min(dist[j][i],res);
        }
      } 
    }
  }

  for(int i=0;i<n+2;i++){
    for(int j=0;j<n+2;j++){
      for(int k=0;k<shade[j].size();k++){
        if(iscontained(shade[i],shade[j][k])){
          dist[j][i] = dist[i][j] = 0;
        }
      }
    }
  }

  for(int k=0;k<n+2;k++){
    for(int i=0;i<n+2;i++){
      for(int j=0;j<n+2;j++){
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  printf("%.10lf\n",dist[n][n+1]);
  
  return true;
}

int main(){
  
  while(solve());
  
  return 0;
}

Measured memory_bytes: 4204