#coding=utf-8
import re
print("二进制转换")
num = input("请输入一个二进制的数:")
pattern = re.compile(r'[^0,1]+')
if (re.search(pattern, num)):
print("输入的格式不正确")
else:
answer = 0
length = len(num)
for i in range(length):
answer += int(num[i])*(2**(length-i-1))
print("转换成十进制为:",answer)