<?php
function HomoCredit($creditSum, $payout){
$totalPayout =0;
for(;;){
$creditSum = ($creditSum*1.04)+500;
if ($creditSum<=5000) {
$totalPayout = $totalPayout + $creditSum;
break;
}
$creditSum = $creditSum - $payout;
$totalPayout = $totalPayout + $payout;
}
return $totalPayout;
}
function Softbank($creditSum, $payout){
$totalPayout =0;
for(;;){
$creditSum = ($creditSum*1.03)+1000;
if ($creditSum<=5000) {
$totalPayout = $totalPayout + $creditSum;
break;
}
$creditSum = $creditSum - $payout;
$totalPayout = $totalPayout + $payout;
}
return $totalPayout;
}
function StrawberryBank ($creditSum, $payout){
$totalPayout =0;
for(;;){
$creditSum = ($creditSum*1.02);
if ($creditSum<=5000) {
$totalPayout = $totalPayout + $creditSum + 7777;
break;
}
$creditSum = $creditSum - $payout;
$totalPayout = $totalPayout + $payout;
}
return $totalPayout;
}
$creditSum = 39999;
$payout = 5000;
$HomoCreditTotal = HomoCredit($creditSum, $payout);
$SoftbankTotal = Softbank($creditSum, $payout);
$StrawberryBankTotal = StrawberryBank($creditSum, $payout);
echo "1 - {$HomoCreditTotal}\n";
echo "2 - {$SoftbankTotal}\n";
echo "3 - {$StrawberryBankTotal}\n";
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCmZ1bmN0aW9uIEhvbW9DcmVkaXQoJGNyZWRpdFN1bSwgJHBheW91dCl7CiR0b3RhbFBheW91dCA9MDsKCWZvcig7Oyl7CgkJJGNyZWRpdFN1bSA9ICgkY3JlZGl0U3VtKjEuMDQpKzUwMDsKCQlpZiAoJGNyZWRpdFN1bTw9NTAwMCkgewoJCQkJJHRvdGFsUGF5b3V0ID0gJHRvdGFsUGF5b3V0ICArICRjcmVkaXRTdW07CgkJCQlicmVhazsKCQkJfQoJCSRjcmVkaXRTdW0gPSAkY3JlZGl0U3VtIC0gJHBheW91dDsgCgkJJHRvdGFsUGF5b3V0ID0gJHRvdGFsUGF5b3V0ICArICRwYXlvdXQ7Cgl9CglyZXR1cm4gJHRvdGFsUG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