uses crt;
var
Decimal, I: Word;
S: string;
function MulPos(p: Word):Word;
var
Mul, J: word;
begin
Mul:=1;
if p>1 then
begin
for j:=1 to (p-1) do Mul:=Mul*2;
MulPos:=Mul;
end
else MulPos:=1;
end;
begin
Decimal:=0;
Write('Ingrese un número en binario: ');
ReadLn(S);
for i:=1 to Length(S) do
begin
if S[i] = '1' then
Decimal:=Decimal+MulPos(i);
end;
WriteLn(Decimal);
readkey;
end.