Coaches are accustomed to submitting a detailed expenditure
report to the accounts department upon returning from
an ACM contest. An inexperienced coach may encounter
a lot of problems at this stage, and the reporting
may became an even harder ordeal for him than the contest itself
was for his team. However, for skilled coaches this is just a formality. But even they may have some problems from time to time. Here is one of such situations.
One day Ivan Ivanovich was summoned to the accounts
department because of an allegedly incorrect expenditure
report. Of course, Ivan Ivanovich was embarrassed, because he always checked his reports many times
and was sure that they were correct. The accountant
told him that the total amount of expenditures in the
report was incorrect. To prove this, the accountant showed him a sheet of paper with individual expenses written out there and calculated the sum by the
column-additon method (true accountants always compute
manually, distrusting machines). The result was different
from that in the report.
Ivan Ivanovich knows that it is senseless to suspect a computing mistake, because accountants' computations are always correct, but he is also sure of his own innocence.
Hence, the mistake sprang up at the stage of copying the figures from the report to the sheet of paper. It remains to find the error, and it's not that easy as there are many items and the accountant was copying them in a strange order known to him only.
Assume that the mistake consisted in swapping two adjacent digits in one of the numbers. Given the list on the accountant's sheet of paper and the sum reported by Ivan Ivanovich, you should determine the erroneously copied number.
Input
The first line of the input contains an integer N (1 ≤ N ≤ 200000), which is the number of the summands in the accontant's list. Each of the next N lines contains a corresponding non-negative integer summand (not exceeding 231−1). And the N+2nd line of the input contains the sum from the report (non-negative integer number, not exceeding 1016). No number contains leading zeroes, besides no leading zeroes can appear as a result of erroneous copying.
Output
If the input data make it possible to find the erroneous number, then output the line "Error in record #L. Correct number is: K.", where L is the number of the sum and K that was copied incorrectly. If such number doesn't exist, then you should output the line "Unrecoverable error." And if the total of the given summands coincides with the sum in the report, then output the line "Input has no error."
Samples
input | output |
---|
3
12
26
45
119
| Error in record #2. Correct number is: 62.
|
3
12
26
45
109
| Unrecoverable error.
|
5
1071
300
1800
2700
4950
10821
| Input has no error.
|
Problem Author: Eugine Krokhalev
Problem Source: Седьмое открытое личное первенство УрГУ по спортивному программированию - 25 февраля 2006 года