{-# OPTIONS_GHC -O #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import Data.Array
import Data.Array.IO

comb :: Int -> [a] -> [[a]]
comb 0 _ = [[]]
comb n xa@(x:xs)
    | length xa == n = [xa]
    | otherwise = ( map (x:) $ comb (n-1) xs) ++ (comb n xs)


main=do
    [n,m]<-map read.words<$>getLine::IO[Int]
    xyzs <- (replicateM n $ unfoldr (B.readInt.B.dropWhile(==' ')) <$> B.getLine)
    --
    print $ maximum $ map (foldl' (\a b -> a + (abs b)) 0. foldl' (\[x,y,z] [a,b,c] -> [a+x,b+y,c+z]) [0,0,0])  $ comb m xyzs