input = 1333

suite = "010001010010000101000011010000001110010000000001110101010000000000001011"

table = ["", ]
for i in range(len(suite)):
    table.append(suite[i])
table += (None,)*input

for i in range(len(table)):
    if table[i] == None:
        if i%3 == 0:
            table[i] = table[i//3]
        else:
            table[i] = table[i-i//3]

res = "".join(table[input:input+16])
print(int(res, 2))
