//PascalABC.NET 3.1 сборка 1239
function BinToDec(bin: string): integer;
begin
var n := 0;
var p := 1;
for var i := length(bin) downto 1 do
begin
n += p * StrToInt(bin[i]);
p *= 2;
end;
Result := n;
end;
begin
var s := ReadlnString('s =');
writeln(BinToDec(s));
end.