#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

#define EPS 1e-8

typedef complex<double> C;
const double PI = 4*atan(1.0);

namespace std{

    bool operator < (const C a, const C b){
        return a.real() != b.real() ? a.real() < b.real() : a.imag() < b.imag();
    }
    bool operator > (const C a, const C b){
        return a.real() != b.real() ? a.real() > b.real() : a.imag() > b.imag();
    }

}

struct L : public vector<C>
{
    L(){}
    L(const C a,const C b){
        push_back(a);push_back(b);
    }
};

double cross(const C a,const C b){
    return imag(conj(a)*b);
}
double dot(const C a,const C b){
    return real(conj(a)*b);
}
int ccw(C a,C b,C 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;
}


C projection(const L& l,const C p){
    double t = dot(p-l[0],l[0]-l[1])/norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}

bool intersectSS(const L&s,const L& t){
    return 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;
}

bool intersectSP(const L& s,const C p){
    return abs(s[0]-p) + abs(s[1]-p) - abs(s[1]-s[0]) < EPS;   
}


double distanceSP(const L &s,const C p){
    const C 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({distanceSP(s,t[0]),distanceSP(s,t[1]),distanceSP(t,s[0]),distanceSP(t,s[1])});
}
double distanceCC(vector<C> &s,vector<C> &t){
    double mi = 1e10;
    int n = s.size();
    int m = t.size();
    rep(i,n){
        L a = L(s[i],s[(i+1)%n]);
        rep(j,m){

            L b = L(t[j],t[(j+1)%m]);
            mi = min(mi,distanceSS(a,b));
        }
    }
    return mi;
}
int contains(const vector<C>&ps,const C p){
    bool flag = false;
    rep(i,ps.size()){
        C a = ps[i]- p, b = ps[(i+1)%ps.size()]-p;
        if(imag(a) > imag(b))swap(a,b);
        if(imag(a) <= 0 && 0 < imag(b)){
            if(cross(a,b)<0)flag = !flag;
        }
        if(cross(a,b)==0&&dot(a,b)<=0) return 1;
    }
    return flag ? 2 : 0;
}

double distanceCP(vector<C> &s,C &t){
    if(contains(s,t)){
        return 0;
    }
    double mi = 1e10;
    int n = s.size();
    rep(i,n){
        L a = L(s[i],s[(i+1)%n]);
        mi = min(mi,distanceSP(a,t));
    }
    return mi;
}

vector<C> convex_hull(vector<C> ps){
    int n = (int)ps.size(),k=0;
    sort(ps.begin(),ps.end());
    vector<C> ch(2*n);
    for(int i=0;i<n;ch[k++] = ps[i++]){
        while(k>=2&&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&&ccw(ch[k-2],ch[k-1],ps[i])<=0)k--;
    }
    ch.resize(k-1);
    return ch;
}



double dist[110][110];
int main(){
    int n;
    while(cin>>n&& n!=0){
        vector<vector<C> >p;
        vector<double> h(n);
        rep(i,n){
            int m;
            cin >> m >> h[i];
            vector<C> a;
            rep(j,m){
                int x,y;
                cin >> x >> y;
                a.push_back(C(x,y));
            }
            p.push_back(a);
        }
        double theta ,phi;
        cin >> theta >> phi;
        theta += 180;
        theta *= 2*PI/360.0;
        phi *= 2*PI/360.0;
        double hfactor = 1.0/tan(phi);
        C s,t;
        int sx,sy,tx,ty;
        cin >> sx >> sy >> tx >> ty;
        s = C(sx,sy);
        t = C(tx,ty);
        vector<vector<C> > X;

        rep(i,n){
            vector<C> q;
            rep(j,p[i].size()){
                q.push_back(p[i][j]);
            }
            double r = h[i]*hfactor;
            
            rep(j,p[i].size()){
                q.push_back(C(q[j].real() + r*cos(theta) , q[j].imag()+r*sin(theta) ));
            }
            q = convex_hull(q);
            X.push_back(q);
            // for(auto xx:q){
            //     cerr << xx << endl;
            // }
        }
        rep(i,n){
            rep(j,i){
                dist[i][j] = distanceCC(X[i],X[j]);    
                dist[j][i] = dist[i][j];
            }
        }
        
        rep(i,n){
            dist[i][n] = distanceCP(X[i],s);
            dist[n][i] = dist[i][n];
            dist[i][n+1] = distanceCP(X[i],t);
            dist[n+1][i] = dist[i][n+1];
        }
        // rep(i,n+2){
        //     rep(j,n+2){
        //         cout << dist[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        dist[n][n+1] = abs(s-t);
        dist[n+1][n] = abs(s-t);
        rep(k,n+2){
            rep(i,n+2){
                rep(j,n+2){
                    dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
                }
            }
        }
        
        // rep(i,n+2){
        //     rep(j,n+2){
        //         cout << dist[i][j] << " ";
        //     }
        //     cout << endl;
        // }
        cout << fixed << setprecision(20) <<  dist[n][n+1] << "\n";
    }

    return 0;
}


Measured memory_bytes: 3812