Here is the original coding problem:
<PROBLEM>

Here are several subtask of the original coding problem, each consists of a subtask decription and a corresponding subsolution:
<SUBTASK>

Your task is to recompose these subsolutions into a whole solution that can directly solve the original problem.
Do not incorporate example usage snippets. Read the actual input from stdin.
Generate your code in the following format:
```<LANGUAGE>
your code here
```
