#Digital eigenvalue.py number = eval(input()) count = 0 Ob = 0 Ox = 0 while number > 0: Ob = number % 10 count += 1 if Ob%2 == count%2: Ox += pow(2,count-1) number = number // 10 print(Ox)