Under construction

Still being built. Things may change

Line Fighter

Time limit2sMemory limit128 MB

Summary
Given N lines with non-negative slopes and an integer K, find the interval of x where the median of the N line values equals K.
Level

Medium7 of 10

Topics
Binary search, Math, Sorting, Geometry
Solved
No attempts yet

Problem

A math-loving monkey has escaped from a zoo and, while exploring the world, invents a problem using (N) lines.

You are given (N) lines on the coordinate plane and an integer (K). Each line has the form (f_i(x)=a_i \times x+b_i). For a real number (x), define (g(x)) as the median of ({f_1(x), f_2(x), \ldots, f_N(x)}). Find every real number (x) such that (g(x)=K).

Input

The first line contains the number of lines (N) and the integer (K). (N) is an odd integer between (3) and (1{,}000{,}000), inclusive, and (K) is an integer between (-100{,}000) and (100{,}000), inclusive.

Each of the next (N) lines contains two integers (a_i) and (b_i), describing one line. For every (i), (0 \le a_i \le 1{,}000{,}000) and (-1{,}000{,}000 \le b_i \le 1{,}000{,}000). No two given lines are identical.

Output

Print two values on the first line: the beginning and the end of the interval of all (x) such that (g(x)=K). Finite values must be rounded to three digits after the decimal point.

If an endpoint goes to infinity, print +inf for positive infinity and -inf for negative infinity. If no such (x) exists, print impossible. The input is guaranteed to have at most one answer interval.

Note

Do not print -0.000. Values strictly between (-0.0005) and (0.0005) should be printed as 0.000.

Examples3

  1. Example 1

    Input
    5 3
    2 -12
    3 -4
    0 3
    2 -3
    1 -1
    
    Expected output
    3.000 4.000
    
  2. Example 2

    Input
    3 0
    0 1
    0 0
    1 0
    
    Expected output
    -inf 0.000
    
  3. Example 3

    Input
    3 0
    1 -1
    3 -4
    2 -3
    
    Expected output
    1.333 1.333