Problem A. Add one

Author:A. Klenin   Time limit:1 sec
Input file:input.txt   Memory limit:64 Mb
Output file:output.txt  

Statement

Your task is the most trivial one: given non-negative integer N, output N + 1.

The only complication is that the integer is given in an unknown base between 2 and 36 inclusive. Because of that, your program should output all possible distinct answers in lexicographically increasing order.

Input file format

Input file contains integer N composed of digits from 0 to 9 and latin capital letters from A to Z, without leading zeroes.

Output file format

Output file must contain all possible distinct answers, one per line. Answers must be output in the same format as input.

Constraints

N contains from 1 to 100 digits

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
32
33
2
9
10
A

Problem C. Customer support

Author:A. Klenin   Time limit:2 sec
Input file:input.txt   Memory limit:64 Mb
Output file:output.txt  

Statement

Customer support department in an "Incomprehension Amateurs, Ltd" software company has call center for answering users' questions. Support prices are as follows:

1.Answer to a question10 USD
2.Correct answer to a question20 USD
3.Correct answer to a question with explanation40 USD
4. Correct answer to a question which was already correctly answered before +10 USD for each previous correct answer

So, for example, if user asks the same question three times, first receives incorrect answer, then correct one, and the third time correct answer with explanation, it will cost him 10 + 20 + (40 + 1 * 10) = 80 USD.

Customers are billed monthly according to call log. Company engineers review the log and for each question determine:

  1. unique number, so the equivalent questions have same numbers,
  2. whether the answer was correct,
  3. whether the answer was short or included detailed enough explanation.
Given that data, your program must calculate the payment amount.

Input file format

Input file contains number of calls N followed by N triples qi ai xi, where qi is integer question number, ai = 1 if the answer was correct, 0 otherwise, xi = 1 if explanation was given, 0 otherwise.

Output file format

Output file must contain a single number — payment amount.

Constraints

1 ≤ N ≤ 10000, 1 ≤ qi ≤ 106.

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
1
9834 0 1
10
2
3
33 1 0
33 0 0
33 1 1
80

Problem G. Going to be a programmer?

Author:A. Klenin   Time limit:2 sec
Input file:input.txt   Memory limit:64 Mb
Output file:output.txt  

Statement

Igor is a computer science freshman student. As opposed to most of his classmates, he actually knows a little about computer programming. Because of this, other students often ask him to write their homework assignments for the "Introductory Programming" course.

He noticed that, although each assignment is unique, they usually follow a simple pattern. In particular, one assignment states:

"Count the number of integers in the array which are [greater than|less than|equal to|not equal to] [value]",

where parts in brackets differ from student to student. Assignments also contain sample input and output to encourage students to test their programs before submission.

Igor have many classmates, so to save time he decided to write a homework generator. He started with the following template:


  count := 0;
  for i := 1 to N do
    if a[i] #cond# #value# then
      Inc(count);

And now he wants to substitute #cond# and #value# based on the sample input from the assignment. Of course, generated program might be different from what was required in the assignment, but at least it would pass the sample test — his classmates are grateful to have even that. Do you know enough Introductory Programming to help Igor?

Your program will be given sample input — an array of N integer values, and the corresponding output R. It must find such substitution strings for #cond# and #value# that after execution of the code snippet above count will be equal to R, or determine that it is impossible.

Input file format

Input file contains integer N followed by N integers ai and then by integer R.

Output file format

The first line of output must contain one of the strings '<', '>', '=', '<>' — substitution for #cond#. The second line must contain an integer — substitution for #value#.

If there is no solution, output file must contain a single character '?' (ASCII 63). If there is more then one solution, output any of them.

Constraints

1 ≤ N ≤ 100, 0 ≤ R ≤ N, 106 ≤ ai ≤ 106.

Sample tests

No. Input file (input.txt) Output file (output.txt)
1
3
10 20 30
2
>
15
2
3
1 1 1
2
?

0.053s 0.003s 17