#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<utility>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// ÉÏ ×ó ÏÂ ÓÒ
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,k;
long long a[105],b[105],c[105],resa,resb,resc,res,ans;
vector<bool> e;
void dfs(int x,int t)
{
	if(x==n+1)
	{
		if(t!=k)
			return ;
		resa=resb=resc=0;
		for(int i=0;i<e.size();i++)
			if(e[i]==1)
				resa+=a[i+1],resb+=b[i+1],resc+=c[i+1];
		res=abs(resa)+abs(resb)+abs(resc);
		ans=max(ans,res);
		return ;
	}
	e.push_back(0);
	dfs(x+1,t);
	e.pop_back();
	e.push_back(1);
	dfs(x+1,t+1);
	e.pop_back();
}
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i]>>c[i];
	dfs(1,0);
	cout<<ans;
	return 0;
}
