use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; struct Input { n: usize, } fn read_input(cin_lock: &mut StdinLock) -> Input { let n = next_token(cin_lock); Input { n } } fn generate_prime_numbers(n: usize) -> Vec { let mut res = vec![true; n + 1]; res[0] = false; res[1] = false; let limit = (n as f64).sqrt() as usize + 1; for i in 2..limit { if !res[i] { continue; } for j in 2..n { if i * j > n { break; } res[i * j] = false; } } return res .iter() .enumerate() .filter(|(_, v)| **v) .map(|(i, _)| i) .collect(); } fn solve1(input: Input) -> bool { let mut res = vec![false; input.n + 1]; res[0] = true; res[1] = true; let prime_numbers = generate_prime_numbers(input.n); for i in 0..input.n { for j in 0..prime_numbers.len() { let p = prime_numbers[j]; if i + p > input.n { break; } if res[i + p] { continue; } if !res[i] { res[i + p] = true } } } return res[input.n]; } fn solve(input: Input) { println!("{}", if solve1(input) { "Win" } else { "Lose" }) } fn next_token(cin_lock: &mut StdinLock) -> T { cin_lock .by_ref() .bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::() .parse::() .ok() .unwrap() } fn main() { let cin = stdin(); let mut cin_lock = cin.lock(); let input = read_input(&mut cin_lock); solve(input); }