#include "stdafx.h"
#include<iostream>
using namespace std;
int main()
{
int x, y, a1, a2, b1, b2, c1=0, c2=0;
cin >> x >> y >> a1 >> a2 >> b1 >> b2 >> c1 >> c2;
if (a1*b2 - a2*b1 >= 0.0001&&a2*b1 - a1*b2 >= 0.0001)
{
cout << a1*x + b1*y + c1;
cout << a2*x + b2*y - c2;
}
system("pause");
return 0;
}