def calculate_waste(r, production_days, query_days):
    waste = 0
    current_day = 1
    production_dict = {day: raw for day, raw in production_days}

    for day in range(1, max(query_days) + 1):

        waste *= (1 - r)

        if day in production_dict:
            waste += production_dict[day] * r
        
        if day in query_days:
            print(f"Day {day}: {waste:.6f}")


r = 0.3333333
production_days = [(1, 27), (6, 27), (3, 27), (4,27), (5,27)]
query_days = [1, 2, 3, 4, 5, 6]

calculate_waste(r, production_days,query_days)
