import collections
s= collections.deque(maxlen=55)

seed = 292929




s.append(seed)
s.append(1)



for n in xrange(2, 55):
    s.append((s[n-2] - s[n-1])% 10**9)




r = collections.deque(maxlen=55)
for n in xrange(55):
    i = (34 * (n+1))% 55
    r.append(s[i])






def getnextr():
    
    r.append((r[0]-r[31])%10**9)
    return r[54]


for n in xrange(219 - 54):
    getnextr()



for i in xrange(5):
    print , getnextr()