const
 sNum  : array [0..15] of char = ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
 sBases: array [0..4] of char = ('d','b','t','o','h');
var
 NUMS : array ['0'..'F'] of byte; BASES: array ['b'..'t'] of byte;
 Inp,Sout  : string; Base,pos : byte; Number, cur:longint;
begin
 ReadLn(Inp);
 for pos := $30 to $39 do NUMS[chr(pos)] := pos-$30;
 for pos := $41 to $46 do NUMS[chr(pos)] := pos-$37;
 Bases['b']:=2;Bases['t']:=4;Bases['o']:=8;Bases['h']:=16;Bases['d'] := 10;
 Base := Bases[inp[ord(inp[0])]]; 
 for pos := 1 to ord(inp[0])-1 do
  begin Number := Number * base; Inc(Number,NUMS[Inp[pos]]); end;
 WriteLn('Введенное число в др. системах счисления:');
 for pos := 0 to 4 do 
  begin
    base := Bases[sBases[pos]]; sOut:=''; cur := number;
    repeat insert(sNum[Cur mod base],sOut,0); Cur := cur div base; 
    until cur = 0;
    WriteLn(sOut,sBases[pos]);
  end;
end.