/* Az tento program skonci, co vypise? */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>

int main(void)
{
  double n = 0;
  long long a, b;
  int fd;
  uint32_t n1, n2;
  long long m1, m2;

  fd = open("/dev/random", O_RDONLY);
  if (fd < 0) {
    printf("open failed\n");
    return 1;
  }
  b = 5;
  a = 3;
  while (((double)a) / b != n) {
    n = ((double)a) / b;
    if (read(fd, &n1, 4) != 4) {
      printf("short read\n");
      return 1;
    }
    if (read(fd, &n2, 4) != 4) {
      printf("short read\n");
      return 1;
    }
    m1 = ((long long)n1) - (1LL << 31);
    m2 = ((long long)n2) - (1LL << 31);
    if (m1 * m1 + m2 * m2 <= (1LL << 62))
      a++;
    b++;
  }
  printf("%9.7lf\n", n);
  return 0;
}

