import Control.Applicative

main :: IO ()
main = solve <$> readLn >>= print

solve :: Int -> Int
solve x = f 1
  where
    f n = let (q, r) = divMod (360 * n) x in
           if r == 0 then q else f (n + 1)
