#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

namespace std{
    bool operator < (const P& a, const P& b){
        return (a.X!=b.X) ? a.X<b.X : a.Y<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}
P unit(const P &p){
    return p/abs(p);
}
P rotate(const P &p, double rad){
    return p *P(cos(rad), sin(rad));
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}
bool intersectSP(const L& s, const P &p){
    return abs(cross(s[0]-p, s[1]-p))<EPS  && dot(s[0]-p, s[1]-p)<EPS;
}

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 distanceLP(const L &l, const P &p) {
  return abs(p - projection(l, p));
}

P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}
VP crosspointCL(const C &c, const L &l){
    VP ret;
    P mid = projection(l, c.p);
    double d = distanceLP(l, c.p);
    if(EQ(d, c.r)){
        ret.push_back(mid);
    }else if(d < c.r){
        double len = sqrt(c.r*c.r -d*d);
        ret.push_back(mid +len*unit(l[1]-l[0]));
        ret.push_back(mid -len*unit(l[1]-l[0]));
    }
    return ret;
}
VP crosspointCS(const C &c, const L &s){
    VP ret;
    VP cp = crosspointCL(c,s);
    for(int i=0; i<(int)cp.size(); i++){
        if(intersectSP(s, cp[i])){
            ret.push_back(cp[i]);
        }
    }
    return ret;
}

bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
bool isParallel(const L &a, const L &b){
    return isParallel(a[1]-a[0], b[1]-b[0]);
}

vector<L> getTangentLine(const C &c, const P &p){
    vector<L> ret;
    P dir = p -c.p;
    if(c.r < abs(dir) +EPS){
        P a = c.p + c.r*unit(dir);
        VP cp = crosspointCL(C(c.p, abs(dir)), L(a, a+dir*P(0,1)));
        for(int i=0; i<(int)cp.size(); i++){
            ret.push_back(L(p, c.p +c.r*unit(cp[i]-c.p)));
        }
    }
    return ret;
}

vector<L> getCommonTangentLine(C a, C b){
    vector<L> ret;
    if(a.p==b.p && EQ(a.r, b.r)) return ret;
    if(a.r < b.r) swap(a,b);
    P ab = b.p -a.p;
    double d = abs(ab);
    if(d+EPS > a.r+b.r){
        ret = getTangentLine(a, a.p +a.r/(a.r+b.r)*ab);
    }
    if(d+EPS > a.r-b.r){
        if(EQ(a.r, b.r)){
            P normal = unit(ab)*P(0,1)*a.r;
            ret.push_back(L(a.p +normal, b.p +normal));
            ret.push_back(L(a.p -normal, b.p -normal));
        }else{
            vector<L> tmp = getTangentLine(a, a.p +a.r/(a.r-b.r)*ab);
            copy(tmp.begin(), tmp.end(), back_inserter(ret));
        }
    }
    return ret;
}

double getAngle(P a, P b, P c){
    b -= a;
    c -= a;
    return abs(arg(b/c));
}

//問題なし
void generate_object(int n, double r, double rr, vector<L> &l, vector<C> &c){
    double theta = PI/(2*n);
    double dr = r / sin(theta);
    l.resize(4);
    //中心の円 [0]
    c.push_back(C(P(0, 0), dr));
    //切れ目の境界
    l[0] = L(rotate(P(rr, 0), theta), rotate(P(-rr, 0), theta));
    l[1] = L(conj(l[0][0]), conj(l[0][1]));
    //左右境界の縦線
    l[2] = L(P(r, INF), P(r, -INF));
    l[3] = L(-l[2][0], -l[2][1]);
    //切れ目の4円
    for(int i=0; i<2; i++){
        for(int j=0; j<2; j++){
            c.push_back(C(l[i][j], r));
        }
    }
    //外側 [5]
    c.push_back(C(P(0, 0), rr +r));
    //内側 [6]
    c.push_back(C(P(0, 0), rr -r));
}

//おそらく問題なし
bool in_object(P p, vector<L> &l, vector<C> &c){
    //中心及び４円の中にある
    for(int i=0; i<5; i++){
        if(abs(p -c[i].p) +EPS < c[i].r){
            return true;
        }
    }
    //円の外側かつ棒の中（左右の境界に触れる）
    if((abs(p.X) +EPS < c[1].r) && (abs(p -c[5].p) +EPS > c[5].r)){
        return true;
    }
    //外側の円の中かつ内側の円の外かつ上側もしくは下側
    if(abs(p) +EPS < c[5].r && abs(p) > c[6].r +EPS &&
       ccw(l[0][0], l[0][1], p)*ccw(l[1][0], l[1][1], p) == 1){
        return true;
    }
    return false;
}

bool isVisible(L ray, vector<L> &l, vector<C> &c){
    VP cp;
    cp.push_back(ray[0]);
    cp.push_back(ray[1]);
    //ray(線分)と線、円の交点を列挙
    for(int i=2; i<4; i++){
        if(!isParallel(ray, l[i]) && intersectSS(ray, l[i])){
            cp.push_back(crosspointLL(ray, l[i]));
        }
    }
    for(int i=0; i<7; i++){
        VP tmp = crosspointCS(c[i], ray);
        for(int j=0; j<(int)tmp.size(); j++){
            cp.push_back(tmp[j]);
        }
    }
    //ソートして重複を削除
    sort(cp.begin(), cp.end());
    cp.erase(unique(cp.begin(), cp.end()), cp.end());
    //いずれかの中点がオブジェクトの内部にあればfalseを返す
    for(int i=0; i<(int)cp.size()-1; i++){
        if(in_object((cp[i+1] +cp[i])/2.0, l, c)){
            return false;
        }
    }
    return true;
}

VP listup(vector<L> &l, vector<C> &c, VP &sg){
    VP ret;
    //中５円の共通接線
    for(int i=0; i<5; i++){
        for(int j=i+1; j<5; j++){
            vector<L> cl = getCommonTangentLine(c[i], c[j]);
            for(int k=0; k<(int)cl.size(); k++){
                //接点を追加(通行可能のみ)
                L ray(projection(cl[k], c[i].p), projection(cl[k], c[j].p));
                if(!isVisible(ray, l, c)) continue;
                ret.push_back(ray[0]);
                ret.push_back(ray[1]);
            }
        }
    }
    //スタート、ゴールから引いた接線（外側含む）
    for(int i=0; i<2; i++){
        for(int j=0; j<6; j++){
            vector<L> tl = getTangentLine(c[j], sg[i]);
            for(int k=0; k<(int)tl.size(); k++){
                //接点を追加(通行可能のみ)
                L ray(sg[i], projection(tl[k], c[j].p));
                if(!isVisible(ray, l, c)) continue;
                ret.push_back(ray[1]);
            }
        }
    }
    //上記では障害物内にある点は列挙されない
    //外側の円と4円の境目
    for(int i=0; i<2; i++){
        VP cp = crosspointCL(c[5], l[i]);
        ret.push_back(cp[0]);
        ret.push_back(cp[1]);
    }
    //重複削除
    sort(ret.begin(), ret.end());
    ret.erase(unique(ret.begin(), ret.end()), ret.end());
    ret.insert(ret.begin(), sg.begin(), sg.end());
    return ret;
}

vector<vector<double> > make_graph(vector<L> &l, vector<C> &c, VP plist){
    int n = plist.size();
    vector<vector<double> > adj(n, vector<double>(n, INF));
    //全ての点の組み合わせについて
    for(int i=0; i<n; i++){
        if(in_object(plist[i], l, c)) continue;
        for(int j=i+1; j<n; j++){
            if(in_object(plist[j], l, c)) continue;
            //直線的に行けるなら結ぶ
            if(isVisible(L(plist[i], plist[j]), l, c)){
                adj[i][j] = adj[j][i] = min(adj[j][i], abs(plist[j] -plist[i]));
            }
            //同じ円上に乗っていてるなら
            for(int k=0; k<6; k++){
                if(EQ(abs(plist[i]-c[k].p), c[k].r) && EQ(abs(plist[j]-c[k].p), c[k].r)){
                    //外側の円については左右の境界をまたがないなら
                    if(k!=5 || plist[i].X *plist[j].X > 0){
                        //円上を移動する(短い方)
                        double theta = getAngle(c[k].p, plist[i], plist[j]);
                        adj[i][j] = adj[j][i] = min(adj[i][j], theta *c[k].r);
                    }
                }
            }
        }
    }    
    return adj;
}

void warshall(vector<vector<double> > &adj){
    int n = adj.size();
    for(int k=0; k<n; k++){
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                adj[i][j] = min(adj[i][j], adj[i][k] +adj[k][j]);
            }
        }
    }
}

int main(){
    cout << fixed;
    cout << setprecision(10);
    while(1){
        int n;
        cin >> n;
        if(n==0) break;
        
        double r,rr;
        cin >> r >> rr;
        VP sg(2);
        for(int i=0; i<2; i++){
            double x,y;
            cin >> x >> y;
            sg[i] = P(x, y);
        }
        if(r/sin(PI/(2*n)) > rr-r +EPS){
            cout << -1 << endl;
            continue;
        }

        vector<L> line;
        vector<C> circle;
        generate_object(n, r, rr, line, circle);
        
        VP plist = listup(line, circle, sg);
        vector<vector<double> > adj = make_graph(line, circle, plist);
        warshall(adj);

        /*
        cerr << plist.size() << endl;
        for(int i=0; i<(int)plist.size(); i++){
            cout << plist[i] << endl;
        }
        */
        
        
        cout << adj[0][1] << endl;
    }
    return 0;
}

