#include
#include
#include
#include
int main(){
int n, m;
scanf("%d%d", &n, &m);
long long T = 0, P = INT_MAX;//输出值
int k = 0;
int cnt = 0;//行数
while(n--){
cnt++;
int t, num;
long long tempP = 0;
scanf("%d", &t);
T += t;
for(int i = 0; i < m;i++){
scanf("%d", &num);
tempP += num;
}
T += tempP;
if(tempP < P){
P = tempP;
k = cnt;
}
}
printf("%d %d %d", T, k, llabs(P));
return 0;
}