var s:string;n:word;begin repeat read(n);s:="";repeat s:=chr(48+15and n+ord(15and n>9)*7)+s;shr(n,4)until n=0;writeln(s)until 1=0end.