r = (rand(10.**(7)..10.**(18)) || 10 ** 10) a, n = gets.split.map(&:to_i) puts r, a ** n % r