uses crt;
var st:string;
i,j,n,d,x,y:integer;
kq,lt:longint;
begin
clrscr;
write('nhap so nhi phan:'); readln(st);
d:=length(st);
kq:=0;
for i:=1 to d do
begin
lt:=1;
for j:=1 to d-i do
lt:=lt*2;
val(st[i],x,y);
kq:=kq+x*lt;
end;
writeln(st,' doi sang he 10 la: ',kq);
readln;
end.