# What's with that weird fraction?

Algebra Level 3

Let $$a_1,a_2,a_3,a_4$$ be positive real numbers such that

$a_1+a_2+a_3+a_4=52.$

Let the maximum possible value of $$a_1a_2a_3a_4$$ be $$P$$.

Given that $$P\equiv n\pmod7$$, find the value of $$\frac{n^3+n^2-n+1}{2}-1$$.

×