import ipdb

# ipdb.set_trace()

buf, pos = [0], 0
for i in range(1,2018):
    pos = ((pos+343)%i)+1
    buf.insert(pos,i)

print(buf[pos+1])
    

78bf049f416fbbbe541b06a3991cabd6f7166f3b
<mask token>

<mask token>
for i in range(1, 2018):
    pos = (pos + 343) % i + 1
    buf.insert(pos, i)
print(buf[pos + 1])

<mask token>
buf, pos = [0], 0
for i in range(1, 2018):
    pos = (pos + 343) % i + 1
    buf.insert(pos, i)
print(buf[pos + 1])

import ipdb
buf, pos = [0], 0
for i in range(1, 2018):
    pos = (pos + 343) % i + 1
    buf.insert(pos, i)
print(buf[pos + 1])

import ipdb

# ipdb.set_trace()

buf, pos = [0], 0
for i in range(1,2018):
    pos = ((pos+343)%i)+1
    buf.insert(pos,i)

print(buf[pos+1])
    
