def number_of_lottery_tickets(total_sales):
    """
    Function to calculate the number of lottery
    tickets to assign for each participants based on sales.

    Args:
        total_sales(int): total sales done by the participant.
    """

    total_sales = int(total_sales)
    max_ticket_to_assign = 15

    sales_ticket_mapping = {20000: 1, 30000: 2, 50000: 5}

    sale_figures = list(sales_ticket_mapping.keys())
    ticket_count = 0

    while (
        total_sales and sale_figures and ticket_count <= max_ticket_to_assign
    ):
        sale = sale_figures.pop()
        if total_sales >= sale:
            remaining_sale = total_sales // sale
            total_sales %= sale
            ticket_count += remaining_sale * sales_ticket_mapping[sale]

    return min(ticket_count, max_ticket_to_assign)