Hexadecimal Digits of an Integral

Compute the n-th digit, in the hexadecimal expansion of the following expression. () 1/2 ∫ ∏∞ 2 ∑∞ 1 2 −1 (−1)k2k+2 36 √ −48(x+1) x dx 0 k=1 2k 2+1 k+1 k=0 In other words, if the expression is equal to n1.n2n3 . . . nk . . . in hexadecimal. Given k, output nk. Each digit is an element of {1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}. For example, the hexadecimal expansion of 1/11 is 0.0F0F0F0F0F... Input The input will consist of at most 50 lines with the value of k (k < 1000001) on each line. Output For each line of input, output the hexadecimal digit on a single line. Sample Input 100 200 Sample Output A 4