Lucy and the Math Analysis

All submissions for this problem are available.
Read problems statements in Russian here
Lucy is taking math analysis classes in her school. She always has a lot of homework and she always spends a considerable amount of time in order to do it, but today she had completely forgotten about it for some reason. So, please, help her!
Lucy asks you to solve to following problem: calculate the following:
Output the result till the Dth digit after the decimal point. We're asking you to output truncated result, but not rounded!
Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
Each test is described by a line of four numbers  a, p, q and D respectively. a, p, q will be given with exactly two digits after the decimal point.
Output
For each test case, output a single line containing the answer to the corresponding test case (with D digits after the decimal point).
Example
Input: 3 0.62 2.71 3.14 42 0.91 4.70 6.67 18 0.01 9.81 8.63 66 Output: 17.903573407202216066481994459833795013850415 796.867901234567901234 0.187143148658300173451688603203754718906234057749209264360779512294
Scoring
In all the test cases, 0.01 <= a < 1.00, 0.00 <= p <= 10.00, 0.00 <= q <= 10.00
Output will not exceed 1 MB
Subtask 1 (31 point): T = 100000, 5 <= D <= 7, 0.01 <= a <= 0.50
Subtask 2 (29 points): T = 100, 50 <= D <= 100
Subtask 3 (15 points): T = 10000, 50 <= D <= 100
Subtask 4 (25 points): 10 <= T <= 100, 1 <= D <= 100000
Author:  xcwgf666 
Editorial  http://discuss.codechef.com/problems/LMA1 
Tags  easy, ltime06, math, xcwgf666 
Date Added:  13102013 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 