N=int(input()) K=N//1000000 Ok=N%1000000 M=Ok//1000 Om=Ok%1000 S=Om//100 MM=Om%10 print(K,"км",M,"м",S,"см",MM,"мм")
1 км 12 м 5 см 2 мм