#include #include using namespace std; boost::multiprecision::cpp_int gcd(boost::multiprecision::cpp_int a, boost::multiprecision::cpp_int b){ if (b == 0){ return a; } else { return gcd(b, a % b); } } struct fraction{ boost::multiprecision::cpp_int num, den; fraction(){ } fraction(boost::multiprecision::cpp_int a, boost::multiprecision::cpp_int b){ boost::multiprecision::cpp_int g = gcd(a, b); num = a / g; den = b / g; } fraction operator +(fraction x){ return fraction(num * x.den + x.num * den, den * x.den); } fraction operator -(fraction x){ return fraction(num * x.den - x.num * den, den * x.den); } fraction operator *(fraction x){ return fraction(num * x.num, den * x.den); } fraction operator /(fraction x){ return fraction(num * x.den, den * x.num); } }; int main(){ int N, K; cin >> N >> K; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } K--; if (K == 0){ cout << "0" << endl; } else if (K == N - 1){ cout << "1/1" << endl; } else { assert(false); vector dp(N); dp[0] = fraction(0, 1); dp[1] = fraction(1, 1); for (int i = 2; i < N; i++){ dp[i] = fraction(A[i - 2] + A[i], A[i]) * dp[i - 1] - fraction(A[i - 2], A[i]) * dp[i - 2]; } fraction x = fraction(1, 1) / dp[N - 1]; fraction ans = x * dp[K]; cout << ans.num << "/" << ans.den << endl; } }