{$T-}
program TEST_OCTDEC;
const CR=CHR(10); NL=CHR(13);
var DEC:INTEGER;
   FUBAR:INTEGER;
  function OCTDEC( OCTVAL:INTEGER ) : INTEGER;
    var DECIMAL    : INTEGER;
        REMAINDER  : INTEGER;
        NEWVAL     : INTEGER;
    begin
      DECIMAL := OCTVAL mod 8;
      REMAINDER := OCTVAL div 8;
      if REMAINDER#0 then
       begin
        NEWVAL := OCTDEC(REMAINDER);
        DECIMAL := DECIMAL + (10 * NEWVAL)
       end;
      OCTDEC := DECIMAL;
    end;
begin
repeat
  WRITE(OUT,NL,CR,'#'); BREAK(OUT);
  READ(INP,FUBAR);
  DEC := OCTDEC(FUBAR);
  WRITE(OUT,NL,CR,FUBAR:6,DEC:6);
  BREAK(OUT);
until FUBAR=0;
end.
