def get_first_duplicate_freq(changes: list):
    """Find the first duplicate frequency.

    Args:
        changes: frequency changes

    Returns:
        first duplicate frequency
    """

    cur_freq = 0
    visited_freqs = set()
    while True:
        for change in changes:
            if cur_freq in visited_freqs:
                return cur_freq
            visited_freqs.add(cur_freq)
            cur_freq += change