require 'prime' class Calc0007 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @n = args.shift.first.to_i @primes = Prime.instance.each(@n).to_a @memo = Array.new(@n + 1) end def calc dp(@n, true) end def dp(k, turn) if k == 0 || k == 1 res = true elsif !@memo[k].nil? res = @memo[k] else ps = @primes.take_while { |p| p < k }.reverse res = ps.any? { |p| dp(k - p, !turn) == turn } end @memo[k] = res !(res ^ turn) end def run calc ? 'Win' : 'Lose' end end puts Calc0007.new(STDIN.readlines).run if __FILE__ == $0