Problem: Find common tangent lines of two circles $c1$ and $c2$.

Constraints

* $-1,000 \leq c1x, c1y, c2x, c2y \leq 1,000$
* $1 \leq c1r, c2r \leq 1,000$
* $c1$ and $c2$ are different

Input

Center coordinates ($cix$, $ciy$) and radii $cir$ of two circles $c1$ are $c2$ are given in the following format.

$c1x \; c1y \; c1r$
$c2x \; c2y \; c2r$

All input values are given in integers.

Output

Print coordinates of the tangent points on circle $c1$ based on the following rules.

* Print the coordinate with smaller $x$ first. In case of a tie, print the coordinate with smaller $y$ first.



The output values should be in a decimal fraction with an error less than 0.00001.

Examples

Input

1 1 1
6 2 2


Output

0.6153846154 1.9230769231
1.0000000000 0.0000000000
1.4183420913 1.9082895434
1.7355040625 0.3224796874


Input

1 2 1
4 2 2


Output

0.6666666667 1.0571909584
0.6666666667 2.9428090416
2.0000000000 2.0000000000


Input

1 2 1
3 2 2


Output

0.5000000000 1.1339745962
0.5000000000 2.8660254038


Input

0 0 1
1 0 2


Output

-1.0000000000 0.0000000000


Input

0 0 1
0 0 2


Output

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#define mm(a,b) memset(a,b,sizeof(a))
#define ACCELERATE (ios::sync_with_stdio(false),cin.tie(0))
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<long long,long long>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define pf(x) printf("%d\n",x)
#define pf2(x,y) printf("%d %d\n",x,y)
#define pf3(x,y,z) printf("%d %d %d\n",x,y,z)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
#define E exp(1.0)
#define db double
#define ll long long
#define ld long double
#define ull unsigned long long
//#define io
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
//#define gc getchar
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
//inline int read()
//{
//    int ret=0,f=0;char c=gc();
//    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
//    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
//    if(f)return -ret;return ret;
//}
const int N=1e2+5;
const db EPS=1e-10;
inline int sign(db a){return a<-EPS?-1:a>EPS;}
inline int cmp(db a,db b){return sign(a-b);}
inline db sqr(db x){return x*x;}
struct Point{
    db x,y;
    Point(){}
    Point(db _x,db _y):x(_x),y(_y){}
    void input(){scanf("%lf%lf",&x,&y);}
    void output(){printf("%.10f %.10f\n",x,y);}
    bool operator == (Point b)const{
        return sign(x-b.x)==0&&sign(y-b.y)==0;
    }
    bool operator < (Point b)const{
        return sign(x-b.x)==0?sign(y-b.y)<0:x<b.x;
    }
    Point operator + (const Point &b)const{
        return Point(x+b.x,y+b.y);
    }
    Point operator - (const Point &b)const{
        return Point(x-b.x,y-b.y);
    }
    db operator ^ (const Point &b)const{
        return x*b.y-y*b.x;
    }
    db operator * (const Point &b)const{
        return x*b.x+y*b.y;
    }
    db len(){return hypot(x,y);}
    db len2(){return x*x+y*y;}
    db distance(Point p){return hypot(x-p.x,y-p.y);}
    Point operator * (const db &k)const{
        return Point(x*k,y*k);
    }
    Point operator / (const db &k)const{
        return Point(x/k,y/k);
    }
    db rad(Point a,Point b){
        Point p=*this;
        return fabs(atan2(fabs((a-p)^(b-p)),(a-p)*(b-p)));
    }
    Point unit(){return *this/len();}
    Point trunc(db r){
        db l=len();
        if(!sign(l))return *this;
        r/=l;
        return Point(x*r,y*r);
    }
    Point rotleft(){return Point(-y,x);}
    Point rotright(){return Point(y,-x);}
    Point rotate(Point p,db angle){
        Point v=(*this)-p;
        db c=cos(angle),s=sin(angle);
        return Point(p.x+v.x*c-v.y*s,p.y+v.x*s+v.y*c);
    }
};
#define cross(p1,p2,p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p3.x-p1.x)*(p2.y-p1.y))
#define crossOp(p1,p2,p3) sign(cross(p1,p2,p3))
struct Line{
    Point s,e;
    Line(){}
    Line(Point _s,Point _e):s(_s),e(_e){}
    bool operator == (Line v){
        return (s==v.s)&&(e==v.e);
    }
    Line(Point p,db angle){
        s=p;
        if(sign(angle-PI/2)==0)e=(s+Point(0,1));
        else e=(s+Point(1,tan(angle)));
    }
    Line(db a,db b,db c){
        if(sign(a)==0){
            s=Point(0,-c/b);e=Point(1,-c/b);
        }else if(sign(b)==0){
            s=Point(-c/a,0);e=Point(-c/a,1);
        }else{
            s=Point(0,-c/b);e=Point(1,(-c-a)/b);
        }
    }
    void input(){s.input();e.input();}
    void adjust(){if(e<s)swap(s,e);}
    db length(){return s.distance(e);}
    //[0,PI)
    db angle(){
        db k=atan2(e.y-s.y,e.x-s.x);
        if(sign(k)<0)k+=PI;
        if(sign(k-PI)==0)k-=PI;
        return k;
    }
    //line|1 on the left|2 on the right|3 on line|
    int relation(Point p){
        int c=sign((p-s)^(e-s));
        if(c<0)return 1;
        else if(c>0)return 2;
        else return 3;
    }
    bool pointonseg(Point p){
        return sign((p-s)^(e-s))==0&&sign((p-s)*(p-e))<=0;
    }
    bool parallel(Line v){
        return sign((e-s)^(v.e-v.s))==0;
    }
    //|0 not intersect|1 non-standard|2 intersect|
    int segcrossseg(Line v){
        int d1=sign((e-s)^(v.s-s));
        int d2=sign((e-s)^(v.e-s));
        int d3=sign((v.e-v.s)^(s-v.s));
        int d4=sign((v.e-v.s)^(e-v.s));
        if((d1^d2)==-2&&(d3^d4)==-2)return 2;
        return (d1==0&&sign((v.s-s)*(v.s-e))<=0)||
            (d2==0&&sign((v.e-s)*(v.e-e))<=0)||
            (d3==0&&sign((s-v.s)*(s-v.e))<=0)||
            (d4==0&&sign((e-v.s)*(e-v.e))<=0);
    }
    //|0 not intersect|1 non-standard|2 intersect|
    int linecrossseg(Line v){
        int d1=sign((e-s)^(v.s-s));
        int d2=sign((e-s)^(v.e-s));
        if((d1^d2)==-2)return 2;
        return (d1==0||d2==0);
    }
    //|0 parallel|1 coincides|2 intersect|
    int linecrossline(Line v){
        if((*this).parallel(v))return v.relation(s)==3;
        return 2;
    }
    //要保证两直线不平行或重合
    Point crosspoint(Line v){
        db a1=(v.e-v.s)^(s-v.s);
        db a2=(v.e-v.s)^(e-v.s);
        return Point((s.x*a2-e.x*a1)/(a2-a1),(s.y*a2-e.y*a1)/(a2-a1));
    }
    db dispointtoline(Point p){
        return fabs((p-s)^(e-s))/length();
    }
    db dispointtoseg(Point p){
        if(sign((p-s)*(e-s))<0||sign((p-e)*(s-e))<0)return min(p.distance(s),p.distance(e));
        return dispointtoline(p);
    }
    //前提是两线段不相交，相交距离就是0了
    db dissegtoseg(Line v){
        return min(min(dispointtoseg(v.s),dispointtoseg(v.e)),min(v.dispointtoseg(s),v.dispointtoseg(e)));
    }
    Point lineprog(Point p){
		return s + ( ((e-s)*((e-s)*(p-s)))/((e-s).len2()) );
	}
	Point symmetrypoint(Point p){
		Point q = lineprog(p);
		return Point(2*q.x-p.x,2*q.y-p.y);
	}
};
struct circle{
    Point p;
    db r;
    circle(){}
    circle(Point _p,db _r):p(_p),r(_r){}
    circle(db _x,db _y,db _r){
        p=Point(_x,_y);r=_r;
    }
    Point point(db a){
        return Point(p.x+r*cos(a),p.y+r*sin(a));
    }
    //三角形的外接圆
    circle(Point a,Point b,Point c){
        Line u=Line((a+b)/2,((a+b)/2)+((b-a).rotleft()));
        Line v=Line((b+c)/2,((b+c)/2)+((c-b).rotleft()));
        p=u.crosspoint(v);
        r=p.distance(a);
    }
    //三角形的内切圆
    circle(Point a,Point b,Point c,bool t){
        Line u,v;
        db m=atan2(b.y-a.y,b.x-a.x),n=atan2(c.y-a.y,c.x-a.x);
        u.s=a;
        u.e=u.s+Point(cos((n+m)/2),sin((n+m)/2));
        m=atan2(a.y-b.y,a.x-b.x),n=atan2(c.y-b.y,c.x-b.x);
        v.s=b;
        v.e=v.s+Point(cos((n+m)/2),sin((n+m)/2));
        p=u.crosspoint(v);
        r=Line(a,b).dispointtoseg(p);
    }
    void input(){
        p.input();
        scanf("%lf",&r);
    }
    void output(){
        printf("%2.f %.2f %.2f\n",p.x,p.y,p,r);
    }
    bool operator == (circle v){
        return (p==v.p)&&sign(r-v.r)==0;
    }
    bool operator < (circle v)const{
        return ((p<v.p)||((p==v.p)&&sign(r-v.r)<0));
    }
    db area(){return PI*r*r;}
    db circumference(){return 2*PI*r;}
    //|0 not|1 on|2 in|
    int relation(Point b){
        db dst=b.distance(p);
        if(sign(dst-r)<0)return 2;
        else if(sign(dst-r)==0)return 1;
        return 0;
    }
    //|0 not|1 on|2 in|
    int relationseg(Line v){
        db dst=v.dispointtoseg(p);
        if(sign(dst-r)<0)return 2;
        else if(sign(dst-r)==0)return 1;
        return 0;
    }
    int relationline(Line v){
        db dst=v.dispointtoline(p);
        if(sign(dst-r)<0)return 2;
        else if(sign(dst-r)==0)return 1;
        return 0;
    }
    //|1 内含|2 内切|3 相交|4 外切|5 相离|
    int relationcircle(circle v){
        db d=p.distance(v.p);
        if(sign(d-r-v.r)>0)return 5;
        if(sign(d-r-v.r)==0)return 4;
        db l=fabs(r-v.r);
        if(sign(d-r-v.r)<0&&sign(d-l)>0)return 3;
        if(sign(d-l)==0)return 2;
        if(sign(d-l)<0)return 1;
    }
    //|0 没有交点|1 一个交点|2 两个交点|
    int pointcrosscircle(circle v,Point &p1,Point &p2){
        int rel=relationcircle(v);
        if(rel==1||rel==5)return 0;
        db d=p.distance(v.p);
        db l=(d*d+r*r-v.r*v.r)/(2*d);
        db h=sqrt(r*r-l*l);
        Point tmp=p+(v.p-p).trunc(l);
        p1 = tmp+((v.p-p).rotleft().trunc(h));
		p2 = tmp+((v.p-p).rotright().trunc(h));
        if(rel==2||rel==4)return 1;
        return 2;
    }
    int pointcrossline(Line v,Point &p1,Point &p2){
        if(!(*this).relationline(v))return 0;
        Point a=v.lineprog(p);
        db d=v.dispointtoline(p);
        d=sqrt(r*r-d*d);
        if(sign(d)==0){
            p1=a;p2=a;
            return 1;
        }
        p1=a+(v.e-v.s).trunc(d);
        p2=a-(v.e-v.s).trunc(d);
        return 2;
    }
    int getcircle(Point a,Point b,db r1,circle &c1,circle &c2){
        circle x(a,r1),y(b,r1);
        int t=x.pointcrosscircle(y,c1.p,c2.p);
        if(!t)return 0;
        c1.r=c2.r=r;
        return t;
    }
    int getcircle(Line u,Point q,db r1,circle &c1,circle &c2){
        db dis=u.dispointtoline(q);
        if(sign(dis-r1*2)>0)return 0;
        if(sign(dis)==0){
            c1.p=q+((u.e-u.s).rotleft().trunc(r1));
            c2.p=q+((u.e-u.s).rotright().trunc(r1));
            c1.r=c2.r=r1;
            return 2;
        }
        Line u1=Line((u.s+(u.e-u.s).rotleft().trunc(r1)),(u.e+(u.e-u.s).rotleft().trunc(r1)));
		Line u2=Line((u.s+(u.e-u.s).rotright().trunc(r1)),(u.e+(u.e-u.s).rotright().trunc(r1)));
		circle cc = circle(q,r1);
		Point p1,p2;
		if(!cc.pointcrossline(u1,p1,p2))cc.pointcrossline(u2,p1,p2);
		c1 = circle(p1,r1);
		if(p1 == p2){
			c2 = c1;
			return 1;
		}
		c2 = circle(p2,r1);
		return 2;
    }
    int getcircle(Line u,Line v,db r1,circle &c1,circle &c2,circle &c3,circle &c4){
        if(u.parallel(v))return 0;//两直线平行
		Line u1=Line(u.s+(u.e-u.s).rotleft().trunc(r1),u.e+(u.e-u.s).rotleft().trunc(r1));
		Line u2=Line(u.s+(u.e-u.s).rotright().trunc(r1),u.e+(u.e-u.s).rotright().trunc(r1));
		Line v1=Line(v.s+(v.e-v.s).rotleft().trunc(r1),v.e+(v.e-v.s).rotleft().trunc(r1));
		Line v2=Line(v.s+(v.e-v.s).rotright().trunc(r1),v.e+(v.e-v.s).rotright().trunc(r1));
		c1.r=c2.r=c3.r=c4.r=r1;
		c1.p=u1.crosspoint(v1);
		c2.p=u1.crosspoint(v2);
		c3.p=u2.crosspoint(v1);
		c4.p=u2.crosspoint(v2);
		return 4;
    }
    int getcircle(circle cx,circle cy,double r1,circle &c1,circle &c2){
		circle x(cx.p,r1+cx.r),y(cy.p,r1+cy.r);
		int t=x.pointcrosscircle(y,c1.p,c2.p);
		if(!t)return 0;
		c1.r=c2.r=r1;
		return t;
	}
	int tangentline(Point q,Line &u,Line &v){
		int x   = relation(q);
		if(x == 2)return 0;
		if(x == 1){
			u = Line(q,q + (q-p).rotleft());
			v = u;
			return 1;
		}
		double d = p.distance(q);
		double l = r*r/d;
		double h = sqrt(r*r-l*l);
		u = Line(q,p + ((q-p).trunc(l) + (q-p).rotleft().trunc(h)));
		v = Line(q,p + ((q-p).trunc(l) + (q-p).rotright().trunc(h)));
		return 2;
	}
	double areacircle(circle v){
		int rel = relationcircle(v);
		if(rel >= 4)return 0.0;
		if(rel <= 2)return min(area(),v.area());
		double d = p.distance(v.p);
		double hf = (r+v.r+d)/2.0;
		double ss = 2*sqrt(hf*(hf-r)*(hf-v.r)*(hf-d));
		double a1 = acos((r*r+d*d-v.r*v.r)/(2.0*r*d));
		a1 = a1*r*r;
		double a2 = acos((v.r*v.r+d*d-r*r)/(2.0*v.r*d));
		a2 = a2*v.r*v.r;
		return a1+a2-ss;
	}
	double areatriangle(Point a,Point b){
		if(sign((p-a)^(p-b)) == 0)return 0.0;
		Point q[5];
		int len = 0;
		q[len++] = a;
		Line l(a,b);
		Point p1,p2;
		if(pointcrossline(l,q[1],q[2])==2){
			if(sign((a-q[1])*(b-q[1]))<0)q[len++] = q[1];
			if(sign((a-q[2])*(b-q[2]))<0)q[len++] = q[2];
		}
		q[len++] = b;
		if(len == 4 && sign((q[0]-q[1])*(q[2]-q[1]))>0)swap(q[1],q[2]);
		double res = 0;
		for(int i = 0;i < len-1;i++){
			if(relation(q[i])==0||relation(q[i+1])==0){
				double arg = p.rad(q[i],q[i+1]);
				res += r*r*arg/2.0;
			}
			else{
				res += fabs((q[i]-p)^(q[i+1]-p))/2.0;
			}
		}
		return res;
	}
};
int getTangents(circle A,circle B,Point *a,Point *b)
{
    int cnt=0;        //存切点用
    if(sign(A.r-B.r)<0){
        swap(A,B);
        swap(a,b);
    }
    double d=sqrt((A.p.x-B.p.x)*(A.p.x-B.p.x)+(A.p.y-B.p.y)*(A.p.y-B.p.y));     //圆心距
    double rdiff=A.r-B.r;      //两圆半径差
    double rsum=A.r+B.r;       //两圆半径和
    if(sign(d-rdiff)<0)return 0;        //1.内含
    double base=atan2(B.p.y-A.p.y,B.p.x-A.p.x);      //向量AB的极角
    if(sign(d)== 0)return -1;        //2.重合
    if(sign(d-rdiff) == 0){       //3.内切
        a[cnt]=b[cnt]=A.point(base);
        cnt++;
        return 1;
    }
    double ang=acos((A.r-B.r)/d);
    a[cnt]=A.point(base+ang);b[cnt]=B.point(base+ang);cnt++;      //4.相交（外切、外离的外公切线也在此求出）
    a[cnt]=A.point(base-ang);b[cnt]=B.point(base-ang);cnt++;      //两条外公切线的切点
    if(sign(d-rsum)==0){        //5.外切
        a[cnt]=b[cnt]=A.point(base);
        cnt++;
    }
    else if(sign(d-rsum)>0){      //6.外离
        double ang=acos((A.r+B.r)/d);
        a[cnt]=A.point(base+ang);b[cnt]=B.point(PI+base+ang);cnt++;
        a[cnt]=A.point(base-ang);b[cnt]=B.point(PI+base-ang);cnt++;
    }
    return cnt;
}
int main(){
    circle A,B;
    Point a[5],b[5];
    A.input();B.input();
    bool flag=0;
    if(sign(A.r - B.r) < 0) flag=1;
    int cnt=getTangents(A,B,a,b);
    if(cnt==-1||cnt==0) return 0;
    vector<Point> v;
    for(int i=0;i<cnt;i++){
        v.push_back(a[i]);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<cnt;i++){
        printf("%.10f %.10f\n",v[i].x,v[i].y);
    }
    return 0;
}