def earliest_bus( notes ):
    """
    Setup: 
    All buses depart at 0 mins. Trip duration of each bus = bus ID in minutes. 
    i.e., every 'ID' mins, the bus with that ID departs from the starting point. 
    Thus, if the time is divisible by the bus ID, that bus will start its departure. 

    Method:
    The remainder between current time and bus ID denotes the time in mins to the 
    previous departure of each bus. Subtracting this value from the bus ID gives
    the time in mins to the next departure of each bus. 

    Task:
    Given the time and available buses, this function returns the product of ID of 
    next earliest bus and minutes to wait to catch that bus. 
    """
    time      = notes[ 'time'  ]
    buses     = notes[ 'buses' ]
    deltas    = [ bus - ( time % bus ) for bus in buses ]
    wait_time = min( deltas )
    next_bus  = buses[ deltas.index( wait_time ) ]
    return wait_time * next_bus