#include <iostream>
#include <vector>int row,column;int main(){std::cin >> row >> column;std::vector<std::vector<int>>input(row, std::vector<int>(column, 0));for (int i = 0; i < row; ++i) {for (int j = 0; j < column; ++j) {int temp = 0;std::cin >> temp;input[i][j] = temp;}}int ans = 0;for (int i = 0; i < column; ++i) {int max = 0;for (int j = 0; j < row; ++j) {max = std::max(input[j][i],max);}ans += max;}std::cout << ans << std::endl;// for (int i = 0; i < row; ++i) {
// for (int j = 0; j < column; ++j) {
// std::cout << input[i][j] << " ";
// }
// std::cout << std::endl;
// }
}