#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)
static const double pi = 3.141592653589793;
typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = 1e-6;    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

namespace std {
  bool operator<(const P a, const P b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P rotateP(P a, P o ,D arg) { //点aを点oを中心に反時計周りにまわした複素数を返す。
	a -= o;
	a *= P(cos(arg / 180 * pi), sin(arg / 180 * pi));
	a += o;
	return a;
}

int ccw(P a, P b, P 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
}
bool isecSS(P a1, P a2, P b1, P b2) {
  return ccw(a1, a2, b1)*ccw(a1, a2, b2) <= 0 &&
         ccw(b1, b2, a1)*ccw(b1, b2, a2) <= 0;
}
VP convexHull(VP ps) {  
  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;
}

bool isecSP(P a1, P a2, P b) {
  return !ccw(a1, a2, b);
}
int inConvex(P 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;
}

P proj(P a1, P a2, P p) {
  return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1);
}

D distSP(P a1, P a2, P p) {
  P r = proj(a1, a2, p);
  if (isecSP(a1, a2, r)) return abs(r-p);
  return min(abs(a1-p), abs(a2-p));
}
D distSS(P a1, P a2, P b1, P b2) {
  if (isecSS(a1, a2, b1, b2)) return 0;
  return min(min(distSP(a1, a2, b1), distSP(a1, a2, b2)),
             min(distSP(b1, b2, a1), distSP(b1, b2, a2)));
}

D hyou[101][101];

int main() {
	cout << setprecision(20) << fixed;
	int N;
	while(cin >> N, N) {
		vector<VP> ps(N);
		vector<D> hs;
		vector<int> ms;
		int m;
		D h;
		rep(i, 101) rep(j, 101) hyou[i][j] = 1e20;
		rep(n, N) {
			cin >> m >> h;
			ms.push_back(m);
			hs.push_back(h);
			D x, y;
			rep(i, m) {
				cin >> x >> y;
				P p = P(x, y);
				ps[n].push_back(p);
			}
		}
		D s,f;
		cin >> s >> f;
		D sx, sy, tx, ty;
		cin >> sx >> sy >> tx >> ty;
		rep(n, N) {
			rep(i, ms[n]) {
				P p2 = ps[n][i] + rotateP(P(- hs[n] / tan(f / 180 * pi), 0), P(0,0), s);
				//cout <<-hs[n] / tan(f) << " " <<p2 << endl;
				ps[n].push_back(p2);
			}
			ps[n] = convexHull(ps[n]);
			ms[n] = (int)ps[n].size();
		}
		rep(n, N) {
			rep(n2, N) {
				D d = 1e10;
				rep(i, ps[n].size()) {
					rep(i2, ps[n2].size()) {
						d = min(d, distSS(ps[n][i], ps[n][(i + 1) % ms[n]], ps[n2][i2], ps[n2][(i2 + 1) % ms[n2]]));
					}
				}
				hyou[n][n2] = min(hyou[n][n2], d);
				hyou[n2][n] = min(hyou[n2][n], d);
				//cout << d << endl;
			}
		}
		rep(k, N){
			rep(i, N) {
				rep(j, N) {
					hyou[i][j] = min(hyou[i][j], hyou[i][k] + hyou[k][j]);
				}
			}
		}
		D ans = abs(P(sx,sy) - P(tx, ty));
		
		rep(st, N){
			D sd = 1e10;
			if(inConvex(P(sx, sy), ps[st]) > 0) sd = 0;
			else {
				rep(i, ps[st].size()){
					sd = min(sd, distSP(ps[st][i], ps[st][(i + 1) % (int)ps[st].size()], P(sx, sy) ));
				}
			}
			rep(go, N) {
				D td = 1e10;
				if(inConvex(P(tx, ty), ps[go]) > 0) td = 0;
				else {
					rep(i, ps[go].size()){
						td = min(td, distSP(ps[go][i], ps[go][(i + 1) % (int)ps[go].size()], P(tx, ty) ));
					}
				}
				
				ans = min(ans, hyou[st][go] + sd + td);
			}
		}
		cout << ans << endl;
					
					
	}
	
}



Measured memory_bytes: 3856