import struct,sys
def GetHash(name):
sum=0x13572468
for n in name:
eax=((sum+struct.unpack("b",n)[0])*0x3721273+0x24681357)%0x100000000
sum=(eax<<25)%0x100000000|(struct.unpack('i',struct.pack('L',eax))[0]>>7)%0x100000000
return sum
def GetStep(n,t,end=0):
Table=[0]*(1<<n)
for k in xrange(n):
for i in xrange(1<<k,1<<n,1<<(k+1)):
Table[i]=k
Table=Table[1:]
Table.reverse()
s=1<<(n-1)
for i in xrange(1<<n):
if s==t:
sindex=i
if s==end:
return Table[sindex:i]
s^=1<<Table[i]
hash=GetHash(sys.argv[1][:15])
Steps=GetStep(9,(hash>>1)%0x100+(1<<8),0)
print Steps
sn=""
for s in xrange(len(Steps)):
sn+=str((Steps[s]+1-(hash>>(s%31))%10)%10)
print sn