with open('input.txt') as input:
    frequencyChanges = input.readlines()
frequencyChanges = [int(change.strip()) for change in frequencyChanges]
frequency = 0
knownFrequencies = {frequency}
searching = True
while searching:
    for frequencyChange in frequencyChanges:
        frequency += frequencyChange
        if frequency in knownFrequencies:
            searching = False
            break
        knownFrequencies.add(frequency)
print(frequency)

cd968c7839d5923588b9266b94f9f9c90fe14894
<mask token>

with open('input.txt') as input:
    frequencyChanges = input.readlines()
<mask token>
while searching:
    for frequencyChange in frequencyChanges:
        frequency += frequencyChange
        if frequency in knownFrequencies:
            searching = False
            break
        knownFrequencies.add(frequency)
print(frequency)

with open('input.txt') as input:
    frequencyChanges = input.readlines()
frequencyChanges = [int(change.strip()) for change in frequencyChanges]
frequency = 0
knownFrequencies = {frequency}
searching = True
while searching:
    for frequencyChange in frequencyChanges:
        frequency += frequencyChange
        if frequency in knownFrequencies:
            searching = False
            break
        knownFrequencies.add(frequency)
print(frequency)
