#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include<map> #include <list> #include <typeinfo> using namespace std; #define REP(a,b) for(long long a = 0;a < b;++a) int main() { int n,b; cin >> n >> b; long double ans_sekibun = 0; long double ans_bibun = 0; REP(i, n) { double hogehoge = 0; cin >> hogehoge; ans_bibun += hogehoge*powl(b, hogehoge - 1); if (hogehoge != -1) { ans_sekibun += (1 / (hogehoge + 1))*pow(b, hogehoge + 1); } else { ans_sekibun += log(b); } } cout << ans_bibun <<endl<< ans_sekibun; } //thank you for reading my code!