%!PS /quicksort { % [ a c b ] -> [ a b c ] 1 dict begin /arr exch def 0 arr length 1 sub quicksort.main arr end } bind def /quicksort.main { % lo hi -> (null) 3 dict begin /hi exch def /lo exch def /xit false def lo 0 lt { /xit true def } if hi 0 lt { /xit true def } if lo hi ge { /xit true def } if xit not { /p quicksort.partition def lo p quicksort.main p 1 add hi quicksort.main } if end } bind def /quicksort.partition { 3 dict begin /pivot arr hi lo add 2 idiv get def /i lo 1 sub def /j hi 1 add def { { /i i 1 add def arr i get pivot ge { exit } if } loop { /j j 1 sub def arr j get pivot le { exit } if } loop i j ge { j exit } if i j quicksort.swap } loop end } bind def /quicksort.swap { 2 dict begin /bi exch def /ai exch def arr ai get arr bi get arr exch ai exch put arr exch bi exch put end } bind def /apush.right { % [a b] c -> [a b c] exch [ exch aload length 2 add -1 roll ] } bind def /strconcat % (a) (b) -> (ab) { exch dup length 2 index length add string dup dup 4 2 roll copy length 4 -1 roll putinterval } bind def /strjoin % [(a) (b) (c)] (j) -> (ajbjc) { 3 dict begin /j exch def dup 0 get /out exch def /first true def { first { pop /first false def } { out j strconcat exch strconcat /out exch def } ifelse } forall out end } bind def /strsplit % (ajbjc) (j) -> [ (a) (b) (c) ] { 1 dict begin /sep exch def [ exch { dup length 0 eq { pop exit } { sep search { exch pop dup length 0 eq { pop } { exch } ifelse } { () } ifelse } ifelse } loop ] end } bind def /map { % array proc -> array 2 dict begin /p exch def [ exch { p } forall ] } bind def /reduce { % array proc -> value 2 dict begin /p exch def /a exch def a 0 get 1 1 a length 1 sub { a exch get p } for end } bind def /listmax { { max } reduce } bind def /listmin { { min } reduce } bind def /median { quicksort dup length 2 idiv get } bind def (%stdin) (r) file 400000 string readstring pop /points 0 array def (\n) strsplit { ( ) strsplit { (,) strsplit { cvi } map /f exch def [ f 0 get cvi 10 string cvs (,) f 1 get cvi 10 string cvs (\n) ] () strjoin print /points points f apush.right def } forall } forall /m [ 0 1 points length 2 sub { /i exch def i 1 points length 1 sub { /j exch def points i get 0 get points j get 0 get ne { points j get 1 get points i get 1 get sub points j get 0 get points i get 0 get sub div } if } for } for ] median def /c points { dup 1 get exch 0 get m mul sub } map median def /x points { 0 get } map def [ [ x listmin x listmax ] { dup 10 string cvs exch m mul c add 10 string cvs } forall ] (,) strjoin print (\n) print