#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double INF = 100000000;
struct point{
  double x, y;
  point(){
    x = 0;
    y = 0;
  }
  point(double x, double y): 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);
  }
};
double abs(point P){
  return sqrt(pow(P.x, 2) + pow(P.y, 2));
}
double dot(point P, point Q){
  return P.x * Q.x + P.y * Q.y;
}
double cross(point P, point Q){
  return P.x * Q.y - P.y * Q.x;
}
double point_distance(point P, point Q){
  return abs(Q - P);
}
struct line{
  point A, B;
  line(){
  }
  line(point A, point B): A(A), B(B){
  }
  
};
point vec(line L){
  return L.B - L.A;
}
double point_line_distance(point P, line L){
  return abs(cross(L.B - L.A, P - L.A)) / abs(vec(L));
}
double point_segment_distance(point P, line L){
  if (dot(L.B - L.A, P - L.A) < 0){
    return point_distance(P, L.A);
  } else if (dot(L.A - L.B, P - L.B) < 0){
    return point_distance(P, L.B);
  } else {
    return point_line_distance(P, L);
  }
}
vector<point> sort_polygon(vector<point> &P){
  int sz = P.size();
  point G;
  for (int i = 0; i < sz; i++){
    G = G + P[i];
  }
  G = G / sz;
  vector<pair<double, int>> P2(sz);
  for (int i = 0; i < sz; i++){
    P2[i] = make_pair(atan2(P[i].y - G.y, P[i].x - G.x), i);
  }
  sort(P2.begin(), P2.end());
  vector<point> ans(sz);
  for (int i = 0; i < sz; i++){
    ans[i] = P[P2[i].second];
  }
  return ans;
}
bool point_in_triangle(point X, point A, point B, point C){
  vector<point> P = {A, B, C};
  sort_polygon(P);
  point tmp = P[0];
  P.push_back(tmp);
  for (int i = 0; i < 3; i++){
    if (cross(P[i + 1] - P[i], X - P[i]) < 0){
      return false;
    }
  }
  return true;
}
vector<point> convex_hull(vector<point> P){
  int sz = P.size();
  point G;
  for (int i = 0; i < sz; i++){
    G = G + P[i];
  }
  G = G / sz;
  while (1){
    sz = P.size();
    bool upd = false;
    point tmp = P[0];
    point tmp2 = P[1];
    P.push_back(tmp);
    P.push_back(tmp2);
    vector<point> Q;
    for (int i = 1; i <= sz; i++){
      if (!point_in_triangle(P[i], G, P[i - 1], P[i + 1])){
        Q.push_back(P[i]);
      } else {
        upd = true;
      }
    }
    if (upd){
      swap(P, Q);
    } else {
      return Q;
    }
  }
}
bool point_in_polygon(point X, vector<point> P){
  int sz = P.size();
  point tmp = P[0];
  P.push_back(tmp);
  for (int i = 0; i < sz; i++){
    if (cross(P[i + 1] - P[i], X - P[i]) < 0){
      return false;
    }
  }
  return true;
}
double point_polygon_distance(point X, vector<point> P){
  int sz = P.size();
  if (point_in_polygon(X, P)){
    return 0;
  }
  point tmp = P[0];
  P.push_back(tmp);
  double ans = INF;
  for (int i = 0; i < sz; i++){
    ans = min(ans, point_segment_distance(X, line(P[i], P[i + 1])));
  }
  return ans;
}
double polygon_distance(vector<point> P, vector<point> Q){
  int szP = P.size();
  int szQ = Q.size();
  for (int i = 0; i < szP; i++){
    if (point_in_polygon(P[i], Q)){
      return 0;
    }
  }
  for (int i = 0; i < szQ; i++){
    if (point_in_polygon(Q[i], P)){
      return 0;
    }
  }
  point tmpP = P[0];
  P.push_back(tmpP);
  point tmpQ = Q[0];
  Q.push_back(tmpQ);
  double ans = INF;
  for (int i = 0; i < szP; i++){
    for (int j = 0; j < szQ; j++){
      ans = min(ans, point_segment_distance(P[i], line(Q[j], Q[j + 1])));
    }
  }
  for (int i = 0; i < szQ; i++){
    for (int j = 0; j < szP; j++){
      ans = min(ans, point_segment_distance(Q[i], line(P[j], P[j + 1])));
    }
  }
  return ans;
}
int main(){
  cout << fixed << setprecision(5);
  while (1){
    int N;
    cin >> N;
    if (N == 0){
      break;
    }
    vector<double> H(N);
    vector<vector<point>> V(N);
    for (int i = 0; i < N; i++){
      int NV;
      cin >> NV;
      cin >> H[i];
      V[i] = vector<point>(NV);
      for (int j = 0; j < NV; j++){
        cin >> V[i][j].x >> V[i][j].y;
      }
    }
    double theta, phi;
    cin >> theta >> phi;
    theta = theta / 180 * PI;
    phi = phi / 180 * PI;
    point S;
    cin >> S.x >> S.y;
    point T;
    cin >> T.x >> T.y;
    vector<vector<point>> V2(N + 2);
    for (int i = 0; i < N; i++){
      int NV = V[i].size();
      point d;
      d.x = H[i] / tan(phi) * cos(theta) * -1;
      d.y = H[i] / tan(phi) * sin(theta) * -1;
      for (int j = 0; j < NV; j++){
        V2[i].push_back(V[i][j]);
        V2[i].push_back(V[i][j] + d);
      }
      V2[i] = sort_polygon(V2[i]);
      V2[i] = convex_hull(V2[i]);
    }
    V2[N].push_back(S);
    V2[N + 1].push_back(T);
    vector<vector<double>> d(N + 2, vector<double>(N + 2, INF));
    for (int i = 0; i < N + 2; i++){
      d[i][i] = 0;
      for (int j = i + 1; j < N + 2; j++){
        if (i < N){
          if (j < N){
            d[i][j] = polygon_distance(V2[i], V2[j]);
          } else {
            d[i][j] = point_polygon_distance(V2[j][0], V2[i]);
          }
        } else {
          d[i][j] = point_distance(V2[i][0], V2[j][0]);
        }
        d[j][i] = d[i][j];
      }
    }
    for (int i = 0; i < N + 2; i++){
      for (int j = 0; j < N + 2; j++){
        for (int k = 0; k < N + 2; k++){
          d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
        }
      }
    }
    cout << d[N][N + 1] << endl;
  }
}
