for(c<-io.Source.stdin)print(if(c<36)c else"%x"format 63+c/60*39-c)