Codeforces Round 328 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

binary search

geometry

two pointers

*2700

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. BCPC

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputBCPC stands for Byteforces Collegiate Programming Contest, and is the most famous competition in Byteforces.

BCPC is a team competition. Each team is composed by a coach and three contestants. Blenda is the coach of the Bit State University(BSU), and she is very strict selecting the members of her team.

In BSU there are *n* students numbered from 1 to *n*. Since all BSU students are infinitely smart, the only important parameters for Blenda are their reading and writing speed. After a careful measuring, Blenda have found that the *i*-th student have a reading speed equal to *r*_{i} (words per minute), and a writing speed of *w*_{i} (symbols per minute). Since BSU students are very smart, the measured speeds are sometimes very big and Blenda have decided to subtract some constant value *c* from all the values of reading speed and some value *d* from all the values of writing speed. Therefore she considers *r*_{i}' = *r*_{i} - *c* and *w*_{i}' = *w*_{i} - *d*.

The student *i* is said to overwhelm the student *j* if and only if *r*_{i}'·*w*_{j}' > *r*_{j}'·*w*_{i}'. Blenda doesn’t like fights in teams, so she thinks that a team consisting of three distinct students *i*, *j* and *k* is good if *i* overwhelms *j*, *j* overwhelms *k*, and *k* overwhelms *i*. Yes, the relation of overwhelming is not transitive as it often happens in real life.

Since Blenda is busy preparing a training camp in Codeforces, you are given a task to calculate the number of different good teams in BSU. Two teams are considered to be different if there is at least one student that is present in one team but is not present in the other. In other words, two teams are different if the sets of students that form these teams are different.

Input

In the first line of the input three integers *n*, *c* and *d* (3 ≤ *n* ≤ 345678, 1 ≤ *c*, *d* ≤ 10^{9}) are written. They denote the number of students Blenda can use to form teams, the value subtracted from all reading speeds and the value subtracted from all writing speeds respectively.

Each of the next *n* lines contains two integers *r*_{i} and *w*_{i} (0 < *r*_{i}, *w*_{i} ≤ 10^{9}, |*r*_{i} - *c*| + |*w*_{i} - *d*| > 0). There are no two students, such that both their reading and writing speeds coincide, i.e. for every *i* ≠ *j* condition |*r*_{i} - *r*_{j}| + |*w*_{i} - *w*_{j}| > 0 holds.

Output

Print the number of different teams in BSU, that are good according to Blenda's definition.

Examples

Input

5 2 2

1 1

4 1

2 3

3 2

3 4

Output

4

Input

7 6 6

3 2

1 7

5 7

3 7

6 4

8 9

8 5

Output

11

Note

In the first sample the following teams are good: (*i* = 1, *j* = 2, *k* = 3), (*i* = 2, *j* = 5, *k* = 1), (*i* = 1, *j* = 4, *k* = 3), (*i* = 5, *j* = 1, *k* = 4).

Note, that for example the team (*i* = 3, *j* = 1, *k* = 2) is also good, but is considered to be the same as the team (*i* = 1, *j* = 2, *k* = 3).

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/19/2024 19:09:03 (k3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|