Yui and Mahjong Set
Contest: Codeforces Round 635 (Div. 1)
Difficulty rating: 3200
Tags: constructive algorithms, interactive

This is an interactive problem.

Yui is a girl who enjoys playing Mahjong.

She has a mysterious set which consists of tiles (this set can be empty). Each tile has an integer value between $$$1$$$ and $$$n$$$, and at most $$$n$$$ tiles in the set have the same value. So the set can contain at most $$$n^2$$$ tiles.

You want to figure out which values are on the tiles. But Yui is shy, she prefers to play a guessing game with you.

Let's call a set consisting of three tiles triplet if their values are the same. For example, $$$\{2,\,2,\,2\}$$$ is a triplet, but $$$\{2,\,3,\,3\}$$$ is not.

Let's call a set consisting of three tiles straight if their values are consecutive integers. For example, $$$\{2,\,3,\,4\}$$$ is a straight, but $$$\{1,\,3,\,5\}$$$ is not.

At first, Yui gives you the number of triplet subsets and straight subsets of the initial set respectively. After that, you can insert a tile with an integer value between $$$1$$$ and $$$n$$$ into the set at most $$$n$$$ times. Every time you insert a tile, you will get the number of triplet subsets and straight subsets of the current set as well.

Note that two tiles with the same value are treated different. In other words, in the set $$$\{1,\,1,\,2,\,2,\,3\}$$$ you can find $$$4$$$ subsets $$$\{1,\,2,\,3\}$$$.

Try to guess the number of tiles in the initial set with value $$$i$$$ for all integers $$$i$$$ from $$$1$$$ to $$$n$$$.

Input format:
The first line contains a single integer $$$n$$$ ($$$4 \le n \le 100$$$).

The second line contains two integers which represent the number of triplet subsets and straight subsets of the initial set respectively.

Output format:
When you are ready to answer, print a single line of form "! $$$a_1$$$ $$$a_2$$$ $$$\ldots$$$ $$$a_n$$$" ($$$0 \le a_i \le n$$$), where $$$a_i$$$ is equal to the number of tiles in the initial set with value $$$i$$$.

Interaction format:
To insert a tile, print a single line of form "+ $$$x$$$" ($$$1 \le x \le n$$$), where $$$x$$$ is the value of the tile you insert. Then you should read two integers which represent the number of triplet subsets and straight subsets of the current set respectively.

After printing a line, do not forget to flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

- fflush(stdout) or cout.flush() in C++;
- System.out.flush() in Java;
- flush(output) in Pascal;
- stdout.flush() in Python;
- see documentation for other languages.

You will get Wrong answer if you insert more than $$$n$$$ tiles.

Hacks

To make a hack you should provide a test in such format:

The first line contains a single integer $$$n$$$ ($$$4 \le n \le 100$$$).

The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$0 \le a_i \le n$$$)  — $$$a_i$$$ is equal to the number of tiles with value $$$i$$$ in the set.

Constraints:
Time limit: 1.0 s
Memory limit: 256.0 MB

Note:
In the first test, the initial set of tiles is $$$\{1, 1, 2, 3, 3, 3, 5, 5\}$$$. It has only one triplet subset $$$\{3, 3, 3\}$$$ and six straight subsets, all equal to $$$\{1, 2, 3\}$$$. After inserting a tile with value $$$1$$$ the set of tiles will be $$$\{1, 1, 1, 2, 3, 3, 3, 5, 5\}$$$ and will have two triplet subsets $$$\{1, 1, 1\}$$$, $$$\{3, 3, 3\}$$$ and nine straight subsets, all equal to $$$\{1, 2, 3\}$$$.

Example input:
5
1 6
2 9
5 12
5 24
6 24

Example output:
+ 1
+ 1
+ 2
+ 5
! 2 1 3 0 2

Editorial:
Suppose $$$c_i$$$ equals to the number of tiles in the current set with value $$$i$$$ (before making a query).
If you insert a tile with value $$$x$$$:
• The delta of triplet subsets is $$$\dbinom{c_x}{2}$$$. Once you're sure that $$$c_x \neq 0$$$ holds, you can determine the exact value of $$$c_x$$$.
• The delta of straight subsets is $$$c_{x-2}c_{x-1}+c_{x-1}c_{x+1}+c_{x+1}c_{x+2}$$$. Once you've known the values of $$$c_{1} \ldots c_{x+1}$$$ and you're sure that $$$c_{x+1} \neq 0$$$, you can determine the exact value of $$$c_{x+2}$$$.
Let's insert tiles with following values in order: $$$n-1$$$, $$$n-2$$$, $$$\ldots$$$, $$$3$$$, $$$1$$$, $$$2$$$, $$$1$$$.
We can easily get $$$a_1$$$ by the delta of triplet subsets since we insert tiles with value $$$1$$$ twice.
Consider the delta of straight subsets when you insert the tile with value $$$1$$$. It equals to $$$a_2(a_3+1)$$$ for the first time and $$$(a_2+1)(a_3+1)$$$ for the second time. Use subtraction to get $$$a_3$$$, then use division to get $$$a_2$$$. (The divisor is $$$a_3+1$$$, which is non-zero)
Finally, let do the following for each $$$x$$$ from $$$2$$$ to $$$n-2$$$. We've known the values of $$$a_{1} \ldots a_{x+1}$$$. Since we've inserted a tile with value $$$x+1$$$ before inserting $$$x$$$, we can use division to get $$$a_{x+2}$$$ by the delta of straight subsets and avoid dividing zero.