class Integer def combination(k) return 0 if k < 0 return 0 if self < k return 1 if k.zero? (self - k + 1..self).inject(:*) / k.factorial end def factorial return 1 if self.zero? (1..self).inject(:*) end end X = gets.to_i sum = 0 comb = 30.combination(X - 1) base = 1 31.times do |i| sum += comb * base base *= 2 end puts "%d %d" % [31.combination(X), sum]