// https://omegaup.com/arena/problem/Uniendo-puntos-con-segmentos
#include <math.h>
#include <stdio.h>

typedef struct {
   float x, y;
} punto;

float distancia(punto p1, punto p2) {
   float dx = p2.x - p1.x;
   float dy = p2.y - p1.y;
   return sqrt(dx * dx + dy * dy);
}

float suma_total(punto p1, punto p2, punto p3, punto p4) {
   return distancia(p1, p2) + distancia(p2, p3) + distancia(p3, p4);
}

int main( ) {
   punto a, b, c, d;
   scanf("%f%f%f%f%f%f%f%f",
      &a.x, &a.y,
      &b.x, &b.y,
      &c.x, &c.y,
      &d.x, &d.y
   );
   printf("%f %f", suma_total(a, b, c, d), suma_total(b, a, d, c));
}
