class PunishmentCalculator {

    public long calculate(int punishmentCounter, int score) {
        long result = this.parameters.getDuration();
        long rate = 100L + this.parameters.getIncrementRate();
        int counter = punishmentCounter;
        long maxDuration = this.parameters.getMaximumDuration();

        while (counter-- > 0) {
            result = multiplyExact(result, rate) / 100;
            if (maxDuration > 0 && result > maxDuration) {
                return maxDuration;
            }
        }

        if (score < 0) {
            result *= -score;
        }

        return maxDuration > 0 ? Math.min(maxDuration, result) : result;
    }

    public  PunishmentCalculator(PunishmentParameters parameters);

}