#!/usr/bin/env python3 # -*- coding: utf-8 -*- import math EPS = 10 ** (-12) def differentiate(exps, b): answer = 0 for a in exps: if abs(a) > EPS: answer += a * b ** (a - 1) return answer def integrate(exps, b): answer = 0 for a in exps: if (-1 - EPS) < a < (-1 + EPS): answer += math.log(b) else: answer += b ** (a + 1) / (a + 1) return answer if __name__ == '__main__': _ = int(input()) b = float(input()) exps = list(map(float, input().split())) print("{:.10f}".format(differentiate(exps, b))) print("{:.10f}".format(integrate(exps, b)))