#!/usr/bin/perl
use 5.016;
use warnings;
sub _f { sub{ $_[1] < $_[2] ? _f($_[0], $_[1]) : $_[2] }->($_[0], ($_[0] / $_[1] + $_[1]) / 2, $_[1]) }
sub f { $_[0] > 0 ? _f($_[0], ($_[0] > 1 ? $_[0] : 1)) : 0 }
say f 2;
IyEvdXNyL2Jpbi9wZXJsCnVzZSA1LjAxNjsKdXNlIHdhcm5pbmdzOwoKc3ViIF9mIHsgc3VieyAkX1sxXSA8ICRfWzJdID8gX2YoJF9bMF0sICRfWzFdKSA6ICRfWzJdIH0tPigkX1swXSwgKCRfWzBdIC8gJF9bMV0gKyAkX1sxXSkgLyAyLCAkX1sxXSkgfQpzdWIgZiB7ICRfWzBdID4gMCA/IF9mKCRfWzBdLCAoJF9bMF0gPiAxID8gJF9bMF0gOiAxKSkgOiAwIH0KCnNheSBmIDI7