# When You're High on Math

**Calculus**Level 5

\[\prod_{k=1}^{\infty}\left(\frac{1+2 \cos \left(\frac{2x}{3^k}\right)}{3}\right)\]

Define the expression above as \(f(x)\) and if

\[\int_{0}^{\infty}(f(x)+f^2(x)+f^3(x)+f^4(x)) \ \mathrm dx=\frac{A}{B}\pi\]

where \(A\) and \(B\) are coprime positive integers. Find the value of \(A+B\).