#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>

void main (void) {
  long count,cyc;
  long p1,p2;
  p1=0; p2=0; count=0; cyc=0;
  double w,x,y,z,t;
  while (1) {
    w = drand48();
    x = drand48();
    y = drand48();
    z = drand48();
    if (w>x) {t=w;w=x;x=t;}
    if (w>y) {t=w;w=y;y=t;}
    if (w>z) {t=w;w=z;z=t;}
    if (x>z) {t=x;x=z;z=t;}
    if (x>y) {t=x;x=y;y=t;}
    if (y>z) {t=y;y=z;z=t;}
    if (z>x+y) p1++;
    if (y>w+x) p2++;
    count++;
    cyc++;
    if (cyc==500) {
      cyc=0;
      cout << p1*1.0/count << " " << p2*1.0/count << "\n";
    }
  }
}

