require "big" primes = [] of BigInt memo = [Hash(BigInt, Bool).new, Hash(BigInt, Bool).new] def find_prime_factors(n : BigInt, primes : Array(BigInt)) temp = n i = BigInt.new(2) while i * i <= temp if temp % i == 0 primes << i while temp % i == 0 temp //= i end end i += 1 end primes << temp if temp > 1 end def can_win(turn : Int32, num : BigInt, primes : Array(BigInt), memo : Array(Hash(BigInt, Bool))) : Bool if memo[turn].has_key?(num) return memo[turn][num] end if num == 1 return turn == 1 end if turn == 0 primes.each do |p| if num % p != 0 next end next_num = num while next_num % p == 0 next_num //= p if can_win(1, next_num, primes, memo) memo[turn][num] = true return true end end end memo[turn][num] = false return false else primes.each do |p| if num % p != 0 next end next_num = num while next_num % p == 0 next_num //= p if !can_win(0, next_num, primes, memo) memo[turn][num] = false return false end end end memo[turn][num] = true return true end end n = BigInt.new(gets.not_nil!.chomp.to_s) find_prime_factors(n, primes) puts can_win(0, n, primes, memo) ? "Alice" : "Bob"