def na10(dana):
pom = 0
for i in range(len(dana)):
x = int(dana[- i - 1])
pom = pom + x * 2 ** i
return pom
print (na10("101010"))
print (na10("110101"))
ZGVmIG5hMTAoZGFuYSk6Cglwb20gPSAwCglmb3IgaSBpbiByYW5nZShsZW4oZGFuYSkpOgoJCXggPSBpbnQoZGFuYVstIGkgLSAxXSkKCQlwb20gPSBwb20gKyB4ICogMiAqKiBpCglyZXR1cm4gcG9tCnByaW50IChuYTEwKCIxMDEwMTAiKSkKcHJpbnQgKG5hMTAoIjExMDEwMSIpKQ==