# Summing Complex Fractional Exponents

Algebra Level 5

$\text{A} = \sum_{r=0}^{2016} \exp \left(\frac{i 2016\pi r^2}{2017}\right), \qquad \text{B} = \sum_{r=0}^{2015} \exp \left(-\frac{i 2017\pi r^2}{2016}\right)$

Given that $$\text{A}$$ and $$\text{B}$$ are defined as above, $$\Re \left( \dfrac {\text{A}}{\text{B}} \right)$$ can be written as $$\sqrt{\dfrac{p}{q}}$$ for coprime positive integers $$p$$ and $$q$$. Evaluate $$p+q$$.

Clarifications:

• $$\exp (x) = e^x$$, where $$e \approx 2.71828$$ denotes the Euler's number.
• $$i = \sqrt{-1}$$.
• If $$a$$ and $$b$$ are real numbers, then $$\Re(a+bi) = a$$.
×