QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 512 MB 満点: 100 ハック可能 ✓

#9587. End-of-Course Chaos

統計

Another exam period has ended. As the semester concludes, teachers are busy grading, and students are anxiously awaiting their results.

After the grading process, the teacher has recorded the scores for all $n$ students in the class. The $i$-th student's score consists of a coursework score $x_i$ (with a maximum of $a$) and an exam score $y_i$ (with a maximum of $b$).

The academic affairs office has set the passing grade at $c$. If the sum of the coursework score and the exam score is less than $c$, the student fails. Upon reviewing the grades, the teacher finds the results quite disheartening.

To save some students from failing, the teacher decides to be lenient and adjust the grades. While the teacher cannot change the exam scores, to ensure fairness, they can choose to add a non-negative integer $d$ to the coursework scores of all students. Note that because there is a maximum limit for the coursework score, if a student's coursework score exceeds the maximum after the addition, it will be capped at the maximum.

The teacher wants to know how many students can be saved from failing by this operation. Please help them find the answer.

Input

The first line contains an integer $n$ ($1 \le n \le 1000$), representing the number of students.

The second line contains three integers $a, b, c$ ($0 \le a, b, c \le 100, a + b = 100$), representing the maximum coursework score, the maximum exam score, and the passing grade, respectively.

The next $n$ lines each contain two integers $x_i$ and $y_i$ ($0 \le x_i \le a, 0 \le y_i \le b$), representing the coursework score and exam score of the $i$-th student.

The last line contains an integer $d$ ($0 \le d \le 100$), representing the points the teacher adds to all students' coursework scores.

Output

Output a single integer, the number of students who are saved from failing.

Examples

Input 1

5
40 60 60
20 25
10 40
25 30
35 50
40 60
10

Output 1

2

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.