If $x$ is a complex number such that $x^2+x+1=0$, then the numerical value of $(x+\frac{1}{x})^2+(x^2+\frac{1}{x^2})^2+(x^3+\frac{1}{x^3})^2+\ldots+(x^{27}+\frac{1}{x^{27}})^{2}$ is equal to?
A) 52 . B) 56 . C) 54. D)58 . E)None of these
Where is this question from? I'm pretty sure it comes from one high school math contest, does anyone one know which math contest and of course i can't solve, I have an answer key but I don't know the solution.