Chef and Dynamo

All submissions for this problem are available.
### Read problem statements in [Hindi](http://www.codechef.com/download/translated/JAN20/hindi/DYNAMO.pdf), [Bengali](http://www.codechef.com/download/translated/JAN20/bengali/DYNAMO.pdf), [Mandarin Chinese](http://www.codechef.com/download/translated/JAN20/mandarin/DYNAMO.pdf), [Russian](http://www.codechef.com/download/translated/JAN20/russian/DYNAMO.pdf), and [Vietnamese](http://www.codechef.com/download/translated/JAN20/vietnamese/DYNAMO.pdf) as well. "The secret impresses no one, the trick you use it for is everything."  The Prestige **This is an interactive problem.** An $N$perfect number is defined as a positive integer with at most $N$ digits (in decimal representation without leading zeros) ― that is, $X$ is an $N$perfect number if $0 \lt X \lt 10^N$. Chef has a friend named Dynamo, who is a legendary magician. Chef learned a new magic trick from him and now, he wants to impress his friend Cheffa by showing her the trick:  First, Cheffa should choose a positive integer $N$ and tell it to Chef.  Then, Cheffa should choose an $N$perfect number $A$ and tell it to Chef, who should then choose a positive integer $S$ and tell it to Cheffa.  Then, Cheffa and Chef should alternately tell each other four $N$perfect numbers $B$, $C$, $D$ and $E$ (in this order). Cheffa chooses $B$ and $D$, while Chef chooses $C$ and $E$.  Cheffa will be really impressed if $S$ turns out to be equal to $A+B+C+D+E$. Otherwise, Cheffa will be angry that Chef was wasting her time with a failed magic trick. Since Chef is busy in the kitchen, you should perform the magic trick for him and impress Cheffa. The grader is acting as Cheffa and it is trying to make the magic trick fail. ### Interaction  First, you should read a line containing a single integer $T$. The description of interaction for $T$ test cases follows.  For each test case, you should start by reading a line containing a single integer $N$. Then, you should perform the following actions:  Read a line containing a single integer $A$.  Print a line containing a single integer $S$.  Read a line containing a single integer $B$.  Print a line containing a single integer $C$.  Read a line containing a single integer $D$.  Print a line containing a single integer $E$.  Finally, you should read a line containing a single integer: $1$ if your predicted sum $S$ is correct or $1$ if it is incorrect. Note that when you receive $1$ at the end of a test case, you should immediately terminate your program to receive a Wrong Answer verdict; otherwise, you may receive any verdict. Don't forget to flush the output after printing each line! ### Constraints  $1 \le T \le 1,000$  $1 \le N \le 18$  $1 \le A, B, C, D, E \lt 10^N$  $1 \le S \le 5 \cdot 10^N$ ### Subtasks **Subtask #1 (20 points):** $1 \le N \le 5$ **Subtask #2 (80 points):** original constraints ### Example ``` You Grader 1 2 10 50 10 12 10 8 1 ``` ### Explanation **Example case 1:** The sum of $A=10$, $B=10$, $C=12$, $D=10$ and $E=8$ is $50$, which is the same as the predicted sum. Note that this example is just supposed to clarify the interaction. The grader will not be as friendly.Author:  amit_dwivedi 
Editorial  https://discuss.codechef.com/problems/DYNAMO 
Tags  amit_dwivedi, amit_dwivedi, interactive, jan20, logic, simple, vijju123 
Date Added:  9082019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, 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. 