def scanner(height, time):
    """Return the position of a given scanner height at a given time."""
    offset = time % ((height - 1) * 2)

    if offset > height - 1:
        return 2 * (height - 1)
    else:
        return offset