n = gets.to_i b = gets.to_i a = gets.split.map(&:to_f) sum1 = 0.0 sum2 = 0.0 n.times do |i| if a[i] != 0.0 sum1 += a[i] * (b ** (a[i] - 1.0)) end if a[i] != -1.0 sum2 += 1.0 / (a[i] + 1.0) * (b ** (a[i] + 1.0)) else sum2 += Math.log(b.abs) end end puts sum1 puts sum2 * 10.0