#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct dot {
double x;
double y;
double z;
dot() {
x=0;
y=0;
z=0;
}
dot (double a, double b, double c) {
x=a;
y=b;
z=c;
}
};
int main() {
vector <dot> a;
double x, y, z, p;
double sump=0;
dot sum=dot();
while (cin>>x &&
cin>>y &&
cin>>z &&
cin>>p)
{
a.push_back(dot(x,y,z));
sum.x+=x*p;
sum.y+=y*p;
sum.z+=z*p;
sump+=p;
}
sum.x/=sump;
sum.y/=sump;
sum.z/=sump;
cout << sum.x << " " << sum.y << " " << sum.z << endl;
for (int i=0; i<a.size(); i++)
{
double l=sqrt((a[i].x-sum.x)*(a[i].x-sum.x) + (a[i].y-sum.y)*(a[i].y-sum.y) + (a[i].z-sum.z)*(a[i].z-sum.z));
cout << l << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJ1Y3QgZG90IHsKCWRvdWJsZSB4OwoJZG91YmxlIHk7Cglkb3VibGUgejsKCWRvdCgpIHsKCQl4PTA7CgkJeT0wOwoJCXo9MDsKCX0KCWRvdCAoZG91YmxlIGEsIGRvdWJsZSBiLCBkb3VibGUgYykgewoJCXg9YTsKCQl5PWI7CgkJej1jOwoJfQp9OwppbnQgbWFpbigpIHsKCXZlY3RvciA8ZG90PiBhOwogICAgZG91YmxlIHgsIHksIHosIHA7CiAgICBkb3VibGUgc3VtcD0wOwogICAgZG90IHN1bT1kb3QoKTsKICAgIHdoaWxlIChjaW4+PnggJiYgCiAgICAgICAgICAgY2luPj55ICYmIAogICAgICAgICAgIGNpbj4+eiAmJiAKICAgICAgICAgICBjaW4+PnApIAogICAgeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICBhLnB1c2hfYmFjayhkb3QoeCx5LHopKTsKICAgICAgICBzdW0ueCs9eCpwOwogICAgICAgIHN1bS55Kz15KnA7CiAgICAgICAgc3VtLnorPXoqcDsKICAgICAgICBzdW1wKz1wOwogICAgfQogICAgc3VtLngvPXN1bXA7CiAgICBzdW0ueS89c3VtcDsKICAgIHN1bS56Lz1zdW1wOwogICAgCiAgICBjb3V0IDw8IHN1bS54IDw8ICIgIiA8PCBzdW0ueSA8PCAiICIgPDwgc3VtLnogPDwgZW5kbDsKICAgIAogICAgZm9yIChpbnQgaT0wOyBpPGEuc2l6ZSgpOyBpKyspCiAgICB7CiAgICAgICAgZG91YmxlIGw9c3FydCgoYVtpXS54LXN1bS54KSooYVtpXS54LXN1bS54KSArIChhW2ldLnktc3VtLnkpKihhW2ldLnktc3VtLnkpICsgKGFbaV0uei1zdW0ueikqKGFbaV0uei1zdW0ueikpOwogICAgICAgIGNvdXQgPDwgbCA8PCBlbmRsOyAKICAgIH0KCXJldHVybiAwOwp9