require 'prime' MAX_N = 10000 def prime_nums(n) arr = [] Prime.each(n) { |p| arr << p } arr end def main n = gets.to_i dp = [false]*(MAX_N + 1) prime_arr = prime_nums(n) 2.upto(n) do |i| res = true use_primes = prime_arr.select{ |p| p < i } use_primes.each do |p| if dp[i - p] res = false break end end dp[i] = res end ans = dp[n] ? 'Lose' : 'Win' end puts main()