X = gets.to_i def comb(n,r) k=n-r if 2*r > n return 1 if r == 0 ((n-r+1)..n).reduce(&:*)/((1..r).reduce(&:*)) end c = comb(31, X) p c, X * c / 31 * (2**31-1)