def ccc_reward(difficulty):
    """ Coins rewarded when finishing CCC problems. """
    base = (difficulty ** 2) - (difficulty ** 1.85)
    extra = 13 ** (difficulty // 10)
    return round(base + extra)