QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 100

#3634. Classic Quarantine

統計

Due to the global COVID-19 pandemic, the national civil protection headquarters has issued a new set of guidelines and instructions aimed at preventing the further spread of the infection among the population. One of the guidelines refers to the mandatory wearing of protective masks in all catering establishments, which includes inns, or pubs.

A sign reading MANDATORY MASK WEARING!!! immediately appeared on the door of a local pub. However, since these are only guidelines, the pub owners cannot force their visitors to wear masks. They have noticed that there are currently $a$ people in the pub wearing masks and $b$ people not wearing masks, and they also know that $n$ more people will arrive at the pub during the evening. A deep understanding of human nature, combined with a good knowledge of their own customers, has allowed the owners to conclude with incredible precision that the $i$-th newly arrived guest will put on a mask if and only if the pub is empty before their arrival or if at least $p_i\%$ of the people in the pub are wearing masks.

Unfortunately, the pub owners do not know the order in which the guests will arrive at the pub, but they know that no one will leave. Therefore, they are interested in the minimum and maximum number of people who will be wearing masks in the pub after all $n$ guests have entered.

Input

The first line contains two integers $a$ and $b$ ($0 \le a, b \le 10^9$).

The second line contains a natural number $n$ ($1 \le n \le 500\,000$).

The $i$-th of the next $n$ lines contains a real number $p_i$ ($0 \le p_i \le 100$). Each of the numbers $p_i$ will be written with two decimal places and will be followed by the '%' character (ASCII 37).

Output

In a single line, print two integers representing the minimum and maximum number of people who will be wearing masks in the pub after all $n$ guests have entered.

Examples

Input 1

5 5
1
51.05%

Output 1

5 5

Input 2

4 6
2
0.00%
45.00%

Output 2

5 6

Input 3

11 19
6
96.47%
30.66%
77.61%
26.20%
36.54%
60.57%

Output 3

13 14

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.