#include #include using namespace std; struct matrix2x2 { double e[2][2]; }; matrix2x2 multiply(const matrix2x2 &a, const matrix2x2 &b) { matrix2x2 c; for (int i = 0; i < 2; ++i) { for (int j = 0; j < 2; ++j) { c.e[i][j] = 0; for (int k = 0; k < 2; ++k) { c.e[i][j] += a.e[i][k] * b.e[k][j]; } } } return c; } template struct num_traits { static T identity_element(); }; template <> struct num_traits { static matrix2x2 identity_element() { matrix2x2 u = { { {1, 0}, {0, 1}, } }; return u; } }; template T power(T x, unsigned int n, Mul mul) { if (n == 0) { return num_traits::identity_element(); } else if (n & 1) { return mul(x, power(x, n - 1, mul)); } else { auto t = power(x, n / 2, mul); return mul(t, t); } } int main() { int N; cin >> N; matrix2x2 A = { { {19.0 / 4, -3}, {1, 0}, } }; auto B = power(A, N, multiply); double ans = B.e[1][0] * 3 + B.e[1][1] * 4; printf("%.10f\n", ans); }