-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU -- http://yukicoder.me/problems/25 -- 解説読んだ後 import Data.List import qualified Data.Set as Set main = do n <- readLn putStrLn $ solve n solve n = let p = primeNumbers n s = Set.fromAscList [0,1] r = resultMap p [2..n] s in if Set.member n r then "Win" else "Lose" resultMap _ [] s = s resultMap p (x:xs) s = let f _ [] s = s f x (p:ps) s | v < 0 = s | Set.notMember v s = f x ps $ Set.insert x s | otherwise = f x ps s where v = x - p ss = f x p s in resultMap p xs ss primeNumbers n = f [2..n] where f [] = [] f (x:xs) = x : f [z | z <- xs, (z `mod` x) > 0]