def reward(total_reward, percentage):
    """
    Reward for a problem with total_reward done to percentage.

    Since the first a few test cases are generally very easy, a linear
    approach will be unfair.  Thus, the reward is given in 20:80 ratio.
    The first 50% gives 20% of the reward, and the last 50% gives 80%
    of the reward.

    Thus, if percentage <= 0.5, then the percentage of reward given is:
    0.2 * (percentage / 0.5) = 0.4 * percentage
    And if percentage >= 0.5, then the weighed percentage is:
    0.2 + 0.8 * ((percentage - 0.5) / 0.5)) = 1.6 * percentage - 0.6
    """
    percentage /= 100
    if percentage <= 0.5:
        weighed_percentage = 0.4 * percentage
    else:
        weighed_percentage = 1.6 * percentage - 0.6
    return round(total_reward * weighed_percentage)