#include <bits/stdc++.h>
using namespace std;

#define dump(a) cerr << #a << " " << a << endl
#define rep(i,n) for(int i = 0; i < (n); i++)
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
using ll = long long;
using vi = vector<int>;

const double EPS = 1e-8;
const double inf = 1e12;

using P = complex<double>;
namespace std{
  bool operator < (const P &a, const P &b){
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
  bool isnan(const P &p){
    return isnan(real(p)) or isnan(imag(p));
  }
}
double cross(const P &p, const P &q){
  return imag(conj(p)*q);
}
double dot(const P &p, const P &q){
  return real(conj(p)*q);
}
struct L : public vector<P>{
  L(const P &p, const P &q){
    push_back(p);
    push_back(q);
  }
};
using G = vector<P>;

int ccw(P a,P b, P c){
  b -= a; c -= a;
  if(cross(b,c)>0) return 1;
  if(cross(b,c)<0) return -1;
  if(dot(b,c)<0) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}


double intersectSP(const L &s, const P &p){
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS;
}
double intersectSS(const L &s, const L &t){
  if(ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
     ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0) return true;
  if(intersectSP(s,t[0]) or intersectSP(s,t[1]) or
     intersectSP(t,s[0]) or intersectSP(t,s[1])) return true;
  return false;
}

P projection(const L &l, const P &p){
  double t = dot(p-l[0],l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}
double distanceSP(const L&s, const P &p){
  const P r = projection(s,p);
  if(intersectSP(s,r)) return abs(r-p);
  return min(abs(s[0]-p),abs(s[1]-p));
}
double distanceSS(const L &s, const L &t){
  if(intersectSS(s,t)) return 0;
  return min(min(distanceSP(s,t[0]),distanceSP(s,t[1])),
	     min(distanceSP(t,s[0]),distanceSP(t,s[1])));
}
double distanceGP(const G &g, const P &p){
  int n = g.size();
  double ans = inf;
  rep(i,n){
    L l(g[i],g[(i+1)%n]);
    ans = min(ans, distanceSP(l,p));
  }
  return ans;
}
double distanceGG(const G &g, const G &h){
  double ans = inf;
  int n = g.size(), m = h.size();
  rep(i,g.size()) rep(j,h.size()){
    L l1(g[i],g[(i+1)%n]), l2(h[j],h[(j+1)%m]);
    ans = min(ans, distanceSS(l1,l2));
  }
  return ans;
}

vector<P> convex_hull(vector<P> ps){
  int n = ps.size(), k = 0;
  sort(ps.begin(),ps.end());
  vector<P> ch(2*n);
  for(int i = 0; i < n; ch[k++] = ps[i++])
    while(k >= 2 and ccw(ch[k-2],ch[k-1],ps[i]) <= 0) --k;
  for(int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--])
    while(k >= t and ccw(ch[k-2],ch[k-1],ps[i]) <= 0) --k;
  ch.resize(k-1);
  return ch;
}

bool containGP(const G &g, const P &p){
  double sum = 0;
  int n = g.size();
  rep(i,n){
    int j = (i+1)%n;
    if(intersectSP(L(g[i],g[j]-g[i]),p))
      return true;
    sum += arg((g[j]-p)/(g[i]-p));
  }
  return abs(sum) > 1;
}

using Cost = double;
class node{
public:
  int v;
  Cost d;
  node(int a_, Cost b_):v(a_),d(b_){}
  bool operator <(const node &n) const { return d > n.d; }
};
class edge{
public:
  int to;
  Cost d;
  edge(){}
  edge(int to_, Cost d_) : to(to_), d(d_) {}
};
class dijkstra{
public:
  vector<vector<edge>> G;
  vector<Cost> dist;
  
  dijkstra(int s, const vector<vector<edge>> &G_):G(G_){
    dist.resize(G.size(),inf);

    priority_queue<node> que;
    que.push(node(s,0));
    dist[s] = 0;

    while(!que.empty()){
      int v = que.top().v;
      Cost d = que.top().d;
      que.pop();

      rep(i,G[v].size()){
	Cost tmp = d + G[v][i].d;
	if(dist[G[v][i].to] > tmp + EPS){
	  dist[G[v][i].to] = tmp;
	  que.push(node(G[v][i].to, tmp));
	}
      }
    }
  }
};

int main(){
  int n;
  while(cin >> n,n){
    vector<G> gs(n);
    vi hs(n);
    rep(i,n){
      int nv; cin >> nv;
      cin >> hs[i];
      rep(j,nv){
	double x, y; cin >> x >> y;
	gs[i].push_back(P(x,y));
      }
    }
    int inttheta; cin >> inttheta;
    double theta = double(inttheta) * M_PI / 180;
    if(inttheta <= 180){
      theta -= M_PI;
    }else{
      theta -= M_PI;
    }
    double phi; cin >> phi;
    phi *= M_PI / 180;
    P s, t;
    double x, y; cin >> x >> y;
    s = P(x, y);
    cin >> x >> y;
    t = P(x, y);

    rep(i,n){
      P diff = polar(hs[i]/tan(phi),theta);
      int m = gs[i].size();
      rep(j,m){
	gs[i].push_back(gs[i][j]+diff);
      }
      gs[i] = convex_hull(gs[i]);
    }

    vector<vector<edge>> g(n+2);
    rep(i,n){
      double d;
      if(containGP(gs[i],s)) d = 0;
      else d = distanceGP(gs[i],s);
      g[i].emplace_back(n,d);
      g[n].emplace_back(i,d);
    }
    rep(i,n){
      double d;
      if(containGP(gs[i],t)) d = 0;
      else d = distanceGP(gs[i],t);
      g[i].emplace_back(n+1,d);
      g[n+1].emplace_back(i,d);
    }
    rep(i,n) FOR(j,i+1,n){
      double d = distanceGG(gs[i],gs[j]);
      g[i].emplace_back(j,d);
      g[j].emplace_back(i,d);
    }
    double d = abs(s-t);
    g[n].emplace_back(n+1,d);
    g[n+1].emplace_back(n,d);
    dijkstra dijk(n, g);
    printf("%.10lf\n", dijk.dist[n+1]);
  }
}



Measured memory_bytes: 4004