while 1:p=raw_input();r=p and'#'+''.join(map(lambda i:hex(15-int(i,16))[2:],p[1:]))or'';print r