<?php
function bank($percent, $commission, $deposit, $monthlyPayment){
for ($i = 0; $i < 99; $i ++){
$deposit = $deposit * $percent + $commission - $monthlyPayment;
if($deposit <= 0){
break;
}
return $i;
}
$creditSum = 39999;
$monthlyPayment = 5000;
$month = bank(1.04, 500, $creditSum, $monthlyPayment);
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCgpmdW5jdGlvbiBiYW5rKCRwZXJjZW50LCAkY29tbWlzc2lvbiwgJGRlcG9zaXQsICRtb250aGx5UGF5bWVudCl7Cglmb3IgKCRpID0gMDsgJGkgPCA5OTsgJGkgKyspewoJJGRlcG9zaXQgPSAkZGVwb3NpdCAqICRwZXJjZW50ICsgJGNvbW1pc3Npb24gLSAkbW9udGhseVBheW1lbnQ7CglpZigkZGVwb3NpdCA8PSAwKXsKCQlicmVhazsKCX0KCXJldHVybiAkaTsKfQoJCgokY3JlZGl0U3VtID0gMzk5OTk7CiRtb250aGx5UGF5bWVudCA9IDUwMDA7CiRtb250aCA9ICBiYW5rKDEuMDQsIDUwMCwgJGNyZWRpdFN1bSwgJG1vbnRobHlQYXltZW50KTs=