def cadence(a, b, required_gap, start):
    """
    For the pair of numbers determine when they first repeat with the required gap
    and the period that it will repeat, starting at the given value

    >>> cadence(67, 7, 1, 0)
    (335, 469)
    >>> cadence(67, 7, 2, 0)
    (201, 469)
    >>> cadence(1789, 37, 1, 0)
    (30413, 66193)
    >>> cadence(17, 13, 21, 0)
    (187, 221)
    """

    value = start
    first = None

    while True:
        if (value + required_gap) % b == 0:
            if first is None:
                first = value
            else:
                return (first, value - first)
        value += a