#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
struct POINT
{
double x,y;
};
double multi(POINT p1,POINT p2,POINT p0)
{
return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);
}
POINT intersection(POINT a,POINT b,POINT c,POINT d)
{
POINT p;
p.x=(multi(a,d,c)*b.x-multi(b,d,c)*a.x)/(multi(a,d,c)-multi(b,d,c));
p.y=(multi(a,d,c)*b.y-multi(b,d,c)*a.y)/(multi(a,d,c)-multi(b,d,c));
return p;
}
int main(void)
{
POINT a,b,c,d;
freopen("r.txt","r",stdin);
cout<<"cin det1:"<<endl;
cin>>a.x>>a.y>>b.x>>b.y;
cout<<"cin det2:"<<endl;
cin>>c.x>>c.y>>d.x>>d.y;
POINT u=intersection(a,b,c,d);
cout<<"x:"<<u.x<<"y:"<<u.y<<endl;
return 0;
}