Under construction

Still being built. Things may change

Linear Regression Is Too Easy 1

Time limit1sMemory limit1024 MB

Summary
Given n points and an intercept b, find the slope a that makes the sum of (a*x_i + b - y_i) closest to 0, or print EZPZ if several slopes tie.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

문제

Yulim is confident about linear regression. During a MatKor club lecture on the topic, she was not paying attention. Dongwoo, who was the instructor at the time, did not like this, so he gave her a harder problem. In ordinary linear regression, given data (x1,y1),…,(xn,yn)(x_1, y_1), \dots, (x_n, y_n), you find real numbers a2a_2 and b2b_2 that minimize ∑i=1n(a2xi+b2−yi)2\sum_{i=1}^n (a_2 x_i + b_2 - y_i)^2, the sum of squared residuals. Dongwoo extended this to the sum of residuals raised to the power kk, ∑i=1n(akxi+bk−yi)k\sum_{i=1}^n (a_k x_i + b_k - y_i)^k, and asked for real numbers aka_k and bkb_k that make this sum as close to 00 as possible. Yulim found this too hard and asked for something easier. Dongwoo thought about it and added two conditions. Only the case k=1k = 1 is asked, and the yy-intercept is fixed so that only the slope must be found.

Help Yulim. For a given bb, find the real number a1a_1 that makes ∑i=1n(a1xi+b−yi)1\sum_{i=1}^n (a_1 x_i + b - y_i)^1 as close to 00 as possible.

입력

The first line contains an integer nn (1≤n≤1051 \le n \le 10^5), the number of data points, and an integer bb (−109≤b≤109-10^9 \le b \le 10^9), the yy-intercept. Each of the next nn lines contains one point, given by integers xix_i and yiy_i (−109≤xi,yi≤109-10^9 \le x_i, y_i \le 10^9). The same point may appear more than once.

출력

On the first line, print the value of a1a_1 that makes ∑i=1n(a1xi+b−yi)1\sum_{i=1}^n (a_1 x_i + b - y_i)^1 as close to 00 as possible.

If the answer is an integer, print it as is. If the answer is a rational number that is not an integer, reduce it to an irreducible fraction p/qp/q (1≤∣p∣1 \le |p|, 2≤q2 \le q, gcd⁡(∣p∣,q)=1\gcd(|p|, q) = 1) and print it in the form p/q. It can be proven that a rational a1a_1 achieving the closest value to 00 always exists.

If more than one a1a_1 is possible, print EZPZ.

Examples4

  1. Example 1

    Input
    2 1
    -1 1
    2 1
    
    Expected output
    0
    
  2. Example 2

    Input
    3 -2
    -1 0
    1 -5
    -1 0
    
    Expected output
    -1
    
  3. Example 3

    Input
    6 3
    -1 1
    0 2
    1 4
    -1 1
    2 5
    2 6
    
    Expected output
    1/3
    
  4. Example 4

    Input
    1 0
    0 0
    
    Expected output
    EZPZ