Var input:string; num:array of string;
res1,res2:real;
i:integer;
begin
readln(input);
num:=input.Split(',');
for i:=1 to num[0].Length do begin
res1 *= 2;
res1 += strtoint(num[0][i]);
end;
for i:=num[1].Length downto 1 do begin
res2 += strtoint(num[1][i]);
res2 /= 2;
end;
writeln(res1+res2);
end.