#include <bits/stdc++.h>

using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

using D = double;
const D PI = acos(D(-1)), EPS = 1e-10;

struct Pt2 {
    D x, y;
    Pt2() {}
    Pt2(D _x, D _y) : x(_x), y(_y) {}
    Pt2 operator+(const Pt2 &r) const { return Pt2(x+r.x, y+r.y); }
    Pt2 operator-(const Pt2 &r) const { return Pt2(x-r.x, y-r.y); }
    Pt2 operator*(const Pt2 &r) const { return Pt2(x*r.x - y*r.y, x*r.y + y*r.x); }
    Pt2& operator+=(const Pt2 &r) { return *this=*this+r; }
    Pt2& operator-=(const Pt2 &r) { return *this=*this-r; }
    Pt2 operator-() const { return Pt2(-x, -y); }

    D abs() const { return sqrt(x*x + y*y); }
    D rabs() const { return max(::abs(x), ::abs(y)); }

    static Pt2 polar(D le, D th) { return Pt2(le * cos(th), le * sin(th)); }
};
ostream& operator<<(ostream& os, const Pt2 &p) {
    os << "(" << p.x << ", " << p.y << ")";
    return os;
}
using P = Pt2;
struct L {
    P s, t;
    L() {}
    L(P _s, P _t) : s(_s), t(_t) {}
    P vec() const { return t-s; }
    D abs() const { return vec().abs(); }
};
using Pol = V<P>;

int sgn(D a) {
    if (abs(a) <= EPS) return 0;
    return (a < 0) ? -1 : 1;
}
int rsgn(D a, D f) {
    if (abs(a) <= f*EPS) return 0;
    return (a < 0) ? -1 : 1;
}
bool near(P a, P b) { return !sgn((a-b).abs()); }

bool lessP(P l, P r) {
    if (sgn(r.x-l.x)) return l.x < r.x;
    if (sgn(r.y-l.y)) return l.y < r.y;
    return false;
}

D cross(P a, P b) { return a.x*b.y - a.y*b.x; }
D dot(P a, P b) { return a.x*b.x + a.y*b.y; }

int ccw(P b, P c) {
    int s = rsgn(cross(b, c), b.rabs());
    if (s) return s;
    if (!sgn(c.rabs()) || !sgn((c-b).rabs())) return 0;
    if (dot(b, c) < 0) return 2;
    if (dot(-b, c-b) < 0) return -2;
    return 0;
}
int ccw(P a, P b, P c) { return ccw(b-a, c-a); }
int ccw(L l, P p) { return ccw(l.s, l.t, p); }

bool insSS(const L &s, const L &t) {
    int a = ccw(s, t.s), b = ccw(s, t.t);
    int c = ccw(t, s.s), d = ccw(t, s.t);
    if (a*b <= 0 && c*d <= 0) return true;
    return false;
}

D distLP(const L &l, const P &p) {
    return abs(cross(l.vec(), p-l.s)) / l.abs();
}

D distSP(const L &s, const P &p) {
    P s2 = s.vec() * P(0, 1);
    if (ccw(s.s, s.s+s2, p) == 1) return (s.s-p).abs();
    if (ccw(s.t, s.t+s2, p) == -1) return (s.t-p).abs();
    return distLP(s, p);
}

D distSS(const L &s, const L &t) {
    if (insSS(s, t)) return 0;
    return min({distSP(s, t.s), distSP(s, t.t), distSP(t, s.s), distSP(t, s.t)});
}

const P& c_at(const Pol &pol, int i) {
    int n = int(pol.size());
    assert(0 <= i && i < 2*n);
    return pol[(i<n) ? i : i-n];
}

int contains(const Pol &pol, P p) {
    int in = -1;
    for (int i = 0; i < int(pol.size()); i++) {
        P a = pol[i], b = c_at(pol, i+1);
        if (ccw(a, b, p) == 0) {
            return 1;
        }
        if (a.y > b.y) swap(a, b);
        if (!(a.y <= p.y && p.y < b.y)) continue;
        if (sgn(a.y - p.y) ? (cross(a-p, b-p) > 0) : (a.x > p.x)) in *= -1;
    }
    return in + 1;
}

Pol convex(Pol p) {
    sort(begin(p), end(p), lessP);
    p.erase(unique(begin(p), end(p), near), end(p));
    Pol up, down;
    for (P d: p) {
        while (up.size() > 1 && ccw(up[up.size()-2], up[up.size()-1], d) == 1) up.pop_back();
        up.push_back(d);
    }
    reverse(begin(up), end(up));
    for (P d: p) {
        while (down.size() > 1 && ccw(down[down.size()-2], down[down.size()-1], d) == -1) down.pop_back();
        down.push_back(d);
    }
    down.insert(begin(down), begin(up) + 1, end(up) - 1);
    return down;
}

const D INF = 1e100;

bool solve() {
    int n;
    cin >> n;
    if (n == 0) return false;
    P s, t;
    V<D> h(n);
    V<Pol> pols;
    for (int i = 0; i < n; i++) {
        int m;
        cin >> m >> h[i];
        Pol pol;
        for (int j = 0; j < m; j++) {
            D x, y;
            cin >> x >> y;
            P p = P(x, y);
            pol.push_back(p);
        }
        pols.push_back(pol);
    }
    D th, ph;
    cin >> th >> ph;
    th = (th / 360.0) * 2 * PI;
    ph = (ph / 360.0) * 2 * PI;
    {
        D x, y;
        cin >> x >> y;
        s = P(x, y);
        cin >> x >> y;
        t = P(x, y);
    }

    for (int i = 0; i < n; i++) {
        int m = int(pols[i].size());
        for (int j = 0; j < m; j++) {
            P p = pols[i][j];
            pols[i].push_back(p + P::polar(h[i] / tan(ph), PI + th));
        }
        pols[i] = convex(pols[i]);
    }

    VV<D> di(n+2, V<D>(n+2, INF));
    auto adde = [&](int a, int b, D x) {
        di[a][b] = min(di[a][b], x);
        di[b][a] = min(di[b][a], x);
    };
    for (int i = 0; i < n+2; i++) {
        adde(i, i, 0);
    }
    adde(n, n+1, (s-t).abs());

    for (int i = 0; i < n; i++) {
        if (contains(pols[i], s)) adde(i, n, 0);
        if (contains(pols[i], t)) adde(i, n+1, 0);

        int m = int(pols[i].size());
        for (int j = 0; j < m; j++) {
            P a = pols[i][j], b = c_at(pols[i], j+1);
            L l = L(a, b);
            adde(i, n, distSP(l, s));
            adde(i, n+1, distSP(l, t));
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            const Pol& lp = pols[i];
            const Pol& rp = pols[j];
            if (contains(lp, rp[0]) || contains(rp, lp[0])) adde(i, j, 0);
            int m1 = int(lp.size()), m2 = int(rp.size());
            for (int k1 = 0; k1 < m1; k1++) {
                for (int k2 = 0; k2 < m2; k2++) {
                    L l1 = L(lp[k1], c_at(lp, k1+1));
                    L l2 = L(rp[k2], c_at(rp, k2+1));
                    adde(i, j, distSS(l1, l2));
                }
            }
        }
    }


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

    cout << di[n][n+1] << endl;
    return true;
}

int main() {
    cout << setprecision(20);
    while (solve()) {}
    return 0;
}


Measured memory_bytes: 3776