#CCBCHHAI0000014. Giá trị hợp lệ đầu tiên (First Value from 1 to 9)
Giá trị hợp lệ đầu tiên (First Value from 1 to 9)
First Value from 1 to 9
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integers in order. An accepted value belongs to the closed interval . Stop at the first accepted value and print only that value. Neither zero nor ten is accepted.
Input
A sequence of at most integers; the final one is the first accepted value and no data follows.
Output
Print one integer: the first value in .
Subtasks
- Subtask 1 (20%): At most 5 integers, each of absolute value at most 10.
- Subtask 2 (30%): At most 100 integers, each of absolute value at most 1000.
- Subtask 3 (50%): At most 100000 integers, each of absolute value at most 1000000.
Examples
Example 1
Input
-3 12 5
Output
5
Explanation
-3 and 12 are outside [1,9]. The first accepted value is 5.
Example 2
Input
9
Output
9
Explanation
Nine is accepted at the upper endpoint and is printed.