#include using namespace std; int main(){ long long rows, cols; cin >> rows >> cols; long long sum = 0; long long min = -1; for(long long i = 0; i < rows; i++){ for(long long j = 0; j < cols; j++){ long long x; cin >> x; if(rows % 2 == 0 && cols % 2 == 0){ if(!(i == j || rows-i == cols-j)){ if(min == -1 || x < min) { min = x; } } } sum += x; } } if (min != -1) sum -= min; cout << sum << endl; }