#include <iostream>
#include <iomanip>
#include <cmath>

typedef double tdouble;

const tdouble eps = 1e-16;
const unsigned n = 4;

void product(tdouble**, tdouble*, tdouble*);
void changing(tdouble**, tdouble*, int, int);
void gausss(tdouble**, tdouble*);
void reverse(tdouble**, tdouble*, tdouble*);

void spherical(tdouble *vectun, tdouble *check)
{
	tdouble diff, diff2 = diff = 0.0;
	for (int i = 0; i < n; i++)
	{
		diff += (vectun[i] - check[i]) * (vectun[i] - check[i]);
		diff2 += vectun[i] * vectun[i] - 2 * vectun[i] * check[i] + check[i] * check[i];
	}
	std::cout << std::scientific << std::setw(14) << diff << ' ' << std::setw(14) << diff2;
}

int main()
{
	tdouble **mtx = new tdouble*[n],
			**mtxun = new tdouble*[n],
			*vect = new tdouble[n],
			*vectun = new tdouble[n],
			*sol = new tdouble[n],
			*check = new tdouble[n];

	for (int i = 0; i < n; i++)
	{
		mtxun[i] = new tdouble[n];
		mtx[i] = new tdouble[n];
		for (int j = 0; j < n + 1; j++)
		{
			std::cin >> (j == n ? vect[i] : mtx[i][j]);
			j == n ? vectun[i] = vect[i] : mtxun[i][j] = mtx[i][j];
		}
	}

	gausss(mtx, vect);
	reverse(mtx, vect, sol);

	product(mtxun, sol, check);
	spherical(vectun, check);

	for (int i = 0; i < n; i++)
	{
		delete[] mtx[i];
		delete[] mtxun[i];
	}
	delete[] mtx;
	delete[] mtxun;
	delete[] check;
	delete[] sol;
	delete[] vect;
	delete[] vectun;
}

void gausss(tdouble **mtx, tdouble *vect)
{
	tdouble c;
	for (int j = 0; j < n; j++)
	{
		tdouble temp = abs(mtx[j][j]);
		int mem = j;
		for (int i = j + 1; i < n; i++)
			if (temp < abs(mtx[i][j]))
			{
				temp = abs(mtx[i][j]);
				mem = i;
			}

		changing(mtx, vect, mem, j);

		for (int i = j + 1; i < n; i++)
		{
			c = mtx[i][j] / mtx[j][j];
			for (int k = j; k < n; k++)
				mtx[i][k] -= c * mtx[j][k];
			vect[i] -= c * vect[j];
		}
	}
}

void reverse(tdouble **mtx, tdouble *vect, tdouble *sol)
{
	for (int i = n - 1; i >= 0; i--)
	{
		tdouble temp = 0.0;
		for (int j = i + 1; j < n; j++)
			temp += mtx[i][j] * sol[j];
		sol[i] = (vect[i] - temp) / mtx[i][i];
	}
}

void changing(tdouble **mtx, tdouble *vect, int line1, int line2)
{
	tdouble *t = mtx[line2];
	mtx[line2] = mtx[line1];
	mtx[line1] = t;
	tdouble r = vect[line2];
	vect[line2] = vect[line1];
	vect[line1] = r;
}

void product(tdouble **mtx, tdouble *sol, tdouble *check)
{
	for (int i = 0; i < n; i++)
	{
		check[i] = 0.0;
		for (int j = 0; j < n; j++)
			check[i] += mtx[i][j] * sol[j];
	}
}