import os
sn_data = [ 0x38, 0x39, 0x07, 0xE0, 0x5A, 0x18, 0x1E, 0xE7, 0x5E, 0x3B,
0xEB, 0xA5, 0xAE, 0x07, 0x06, 0x27, 0x0D, 0x89, 0xF1, 0x6E,
0xD8, 0x0D, 0x3A, 0xE0, 0x1E, 0x96, 0xA7, 0xB2, 0x7D, 0x15,
0x16, 0x37, 0x01, 0x41, 0x4B, 0x08, 0x1C, 0x1D, 0x33, 0x2B,
0x40, 0x49, 0x79, 0xE3, 0x04, 0xFA, 0x05, 0x47, 0x66, 0x1B,
0xDB, 0x9E, 0x2C, 0x2D, 0x4E, 0x20, 0x87, 0x9E, 0xBB, 0xE9,
0x14, 0x8A, 0x36, 0x7E, 0xD5, 0x63, 0x51, 0x71, 0x3C, 0x41,
0x37, 0xA8, 0x2E, 0x01, 0x02, 0x23, 0x24, 0x63, 0x46, 0xE9,
0x08, 0x09, 0x19, 0x2B, 0x48, 0x4D, 0xBD, 0xBC, 0x22, 0x11,
0x6C, 0x33, 0x34, 0x77, 0xE0, 0x27, 0x18, 0x6C, 0x35, 0x3B,
0xB6, 0x8F, 0x46, 0x10, 0xC3, 0x43, 0x22, 0x5E, 0x44, 0xB3,
0x8C, 0x53, 0x28, 0xA4, 0xCB, 0xF0, 0x81, 0xD6, 0x96, 0x0F,
0x5C, 0x31, 0x32, 0x19, 0xF0, 0xDA, 0x50, 0x4E, 0x94, 0xF7,
0x27, 0x4E, 0x40, 0x7A, 0x33, 0x1F, 0x20, 0x41, 0x42, 0x6C,
0x66, 0x05, 0x49, 0xA4, 0x48, 0x49, 0x30, 0xAC, 0x0C, 0xBE,
0x2E, 0x2F, 0x30, 0x9D, 0x18, 0x2A, 0x23, 0x23, 0x6F, 0x0B,
0x20, 0x21, 0x2A, 0x6E, 0x4F, 0x83, 0x3E, 0x3F, 0x51, 0x63,
0x9A, 0x03, 0x53, 0x25, 0x26, 0x48, 0xCF, 0x4C, 0x0A, 0x0B,
0x98, 0xB7, 0x88, 0x4F, 0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 0x40, 0xCB, 0x08, 0x31, 0xC2, 0xCF, 0x39, 0x4E]
fp = open('out.txt','r')
check_data = []
for x in fp.read():
if x == '\x0d' or x == '\x0a' or x == '\x20':
continue
check_data.append(int(x))
#print x,
print len(check_data)
print check_data
fp.close()
fp = open('out1.txt','r')
idx_data = []
data_list = fp.readlines()
for data in data_list:
if data == '\x0a':
continue
#print hex(ord(data[0])),hex(ord(data[1]))
idx_data.append(int(data[:-1],16))
print len(idx_data)
print idx_data
x = 0xc23f6401c93adb
y = 0xeedcea3743d03a263af94f386de1
z = x*y
print len(str(z))
cnt = 0
cnt1 = 0
lo = []
while True:
if z == 0:
break
tmp = z % 0x10
if tmp == 0:
z /= 0x10
continue
if tmp <= 9:
cnt = cnt + 1
cnt1 += 1
else:
for i in range(tmp-9):
lo.append(cnt)
#print cnt,
cnt = cnt + 1
z /= 0x10
print cnt1
print lo
a = []
c = []
for i in range(0x80):
a.append(i)
c.append(0)
for i in range(len(g)):
g[i] = g[i] & 0x7f
for i in range(len(s)):
s[i] = s[i] & 0x7f
'''
for j in range(1):
for i in range(len(g)):
c[a[g[i]]] += 1
c[a[s[i]]] += 1
t = a[g[i]]
a[g[i]] = a[s[i]]
a[s[i]] = t
'''
'''
for i in range(4):
c[a[g[i]]] += 1
c[a[s[i]]] += 1
t = a[g[i]]
a[g[i]] = a[s[i]]
a[s[i]] = t
t = a[s[4]]
a[s[4]] = a[g[4]]
c[a[s[4]]] += 1
'''
#print ''
def search(x,cnt):
for i in range(10):
t = i
for j in range(cnt):
t = (t*9)^0x37
t &= 0xff
#print t,
if t == x:
#print i
return i
return -1
def calc_m(x,cnt):
t = x
for i in range(cnt):
t = (t*9)^0x37
return t&0xff
real_lo = []
def check_zero(x):
for i in range(len(x)):
if x[i] == '0':
return 1
return 0
real_ans = []
for i in range(58):
real_ans.append('1')
for i in range(10000000):
c[a[g[i%len(g)]]] += 1
c[a[s[i%len(g)]]] += 1
t = a[g[i%len(g)]]
a[g[i%len(g)]] = a[s[i%len(g)]]
a[s[i%len(g)]] = t
ans = ''
for i1 in range(len(lo)):
flag = 0
for j in range(len(a)):
if a[j] == lo[i1]:
change_lo = j
break
for j in range(len(idx_data)):
if idx_data[j] == change_lo:
flag = j
break
t = check_data[flag]
idx = 0
for j in range(len(sn_data)):
if t == sn_data[j]:
idx = j
value = search(idx,c[lo[i1]])
#print j,value
if value != -1:
ans += str(value)
#real_ans[real_lo[i]] = str(value)
#print ans
#print hex(int(ans[::-1]))[2:-1].upper()[::-1]
if len(ans) >= 58:
h_ans = hex(int(ans[::-1]))[2:-1].upper()[::-1]
print h_ans
if check_zero(h_ans) == 0:
print h_ans
break