var s:string;i,k:comp;begin repeat readln(s);if s<"0x"then s:="8#"+s;if s<"1"then s[1..2]:="$0";val(s,i,k);writeln(i)until 0>0end.