Cos(NA)

Have you ever looked at formulae of the form Cos(NA)? If you havent looked at them yet, just look at them now: Cos(2A) = Cos(3A) = Cos(4A) = 2Cos2(A) − 1 4Cos3(A) − 3Cos(A) 8Cos4(A) − 8Cos2(A) + 1 These formulae will make you believe that any Cos(NA) can be expanded in an expression which contains only one function Cos(A) and all the coefficients are also integers. In this problem your job is to find such a formula for Cos(NA) given the value of N. Input The input file contains at most 50 lines of inputs. Each line contains a positive integer N (N < 50). Input is terminated by a line containing a single zero. Output For each line of input except the last one you should produce one line of output. This line should contain the formula (As described in the problem statment) for Cos(NA). You dont need to print any redundant things in the output such as (a) Printing operators in two consecutive places (b) Printing the exponent when it is 1 (c) Printing the coefficient when it is 1 (d) Just look at the output for sample input for details. Sample Input 2 3 4 0 Sample Output 2Cos^2(A)-1 4Cos^3(A)-3Cos(A) 8Cos^4(A)-8Cos^2(A)+1