def nCr n,r res = 1 r.times { |i| res *= n-i } r.times { |i| res /= i+1 } res end def solve x return [0,0] if x > 31 cnt = nCr(31, x) sum = 31.times.map { |i| (2**i) * nCr(30, x-1) }.inject(:+) [cnt, sum] end puts (solve gets.to_i).join(' ')