def compute_avg_headway(headways):
    """
    Compute the average headways from the sum of all trips with the
    specified headways.
    :param headways: (list of int) list of headways
    """
    if not headways:
        return 0
    frequency = sum([1 / headway for headway in headways])
    return 1 / frequency