import           Control.Monad
import           Data.List

main :: IO ()
main = do
  [n, m] <- getInts
  xs <- replicateM n getInts
  print $ solve xs n m

getInts :: IO [Int]
getInts = map read . words <$> getLine

solve xs n m = maximum
               $ map (abs . sum . take m . sort)
               $ map (\f -> map f xs) fs

fs = map (\[o1, o2, o3] -> (\[a, b, c] -> 0 `o1` a `o2` b `o3` c)) $ replicateM 3 [(+), (-)]
