#53319: python一行解


cathay404@gmail.com (yohan.0323)


由題目可知最小值依序為[16,8,4,2,1]

print(sum([y for x,y in zip(list(input()),[16,8,4,2,1]) if x=="1"]))