<?php 
	error_reporting(-1);

	function getCreditPayment($current, $percent, $service) {
		$payed = 0;
		$monthlyPayment = 5000;
		for ($i = 0; $current > 0; $i++) {
			$current = $current*$percent + $service - $monthlyPayment;
			$payed += $monthlyPayment;
			if ($current < 0) {
				$payed += $current;
			}
		}
		return ceil($payed);
	}

	$totalHomoCredit = getCreditPayment(39999, 1.04, 500);
	$totalSoftbank = getCreditPayment(39999, 1.03, 1000);
	$totalStrawberryBank = getCreditPayment(39999+7777, 1.02, 0);

	echo "HomoCredit: {$totalHomoCredit}\n";
	echo "Softbank : {$totalSoftbank}\n";
	echo "StrawberryBank: {$totalStrawberryBank}";
?>