{-# LANGUAGE ScopedTypeVariables #-}
import Data.Char

main :: IO ()
main = do
  n :: Int <- readLn :: IO Int
  if n == -1
    then return ()
    else do
      putStrLn $ solve n
      main


tenToFour :: Int -> [Int]
tenToFour n = unko n []
  where unko n ls
          | n < 4 = n:ls
          | otherwise = unko (n `div` 4) ((n `mod` 4):ls)

intToStr :: [Int] -> String
intToStr = map numa
  where numa i = chr (i + (ord '0'))

solve :: Int -> String
solve = intToStr . tenToFour