#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long sc[203][203];
long long dp[400][200][200];
map<pair<long long, long long>, long long> bef, aft;
int main() {
  for (long long i = 0; i < 203; i++)
    for (long long j = 0; j < 203; j++) sc[i][j] = INT64_MIN / 5;
  long long H, W;
  cin >> H >> W;
  for (long long i = 0; i < H; i++) {
    for (long long j = 0; j < W; j++) {
      cin >> sc[i][j];
    }
  }
  priority_queue<pair<long long, pair<long long, long long>>> Q;
  queue<pair<long long, pair<long long, long long>>> NQ;
  Q.push({sc[0][0], {0, 0}});
  long long e8, sq, h, w, t = 0;
  while (!Q.empty()) {
    while (!Q.empty()) {
      auto x = Q.top().second;
      long long y = Q.top().first;
      Q.pop();
      if (y < 0) continue;
      tie(e8, sq) = x;
      if (dp[t][e8][sq] >= y) continue;
      dp[t][e8][sq] = y;
      if (e8 == sq) {
        NQ.push({y + sc[e8 + 1][t - e8], {e8 + 1, sq + 1}});
        NQ.push({y + sc[e8 + 1][t - e8] + sc[sq][t - sq + 1], {e8 + 1, sq}});
        NQ.push({y + sc[e8][t - e8 + 1] + sc[sq + 1][t - sq], {e8, sq + 1}});
        NQ.push({y + sc[e8][t - e8 + 1], {e8, sq}});
      } else if (e8 + 1 == sq) {
        NQ.push(
            {y + sc[e8 + 1][t - e8] + sc[sq + 1][t - sq], {e8 + 1, sq + 1}});
        NQ.push({y + sc[e8 + 1][t - e8], {e8 + 1, sq}});
        NQ.push({y + sc[e8][t - e8 + 1] + sc[sq + 1][t - sq], {e8, sq + 1}});
        NQ.push({y + sc[e8][t - e8 + 1] + sc[sq][t - sq + 1], {e8, sq}});
      } else if (sq + 1 == e8) {
        NQ.push(
            {y + sc[e8 + 1][t - e8] + sc[sq + 1][t - sq], {e8 + 1, sq + 1}});
        NQ.push({y + sc[e8 + 1][t - e8] + sc[sq][t - sq + 1], {e8 + 1, sq}});
        NQ.push({y + sc[e8][t - e8 + 1], {e8, sq + 1}});
        NQ.push({y + sc[e8][t - e8 + 1] + sc[sq][t - sq + 1], {e8, sq}});
      } else {
        NQ.push(
            {y + sc[e8 + 1][t - e8] + sc[sq + 1][t - sq], {e8 + 1, sq + 1}});
        NQ.push({y + sc[e8 + 1][t - e8] + sc[sq][t - sq + 1], {e8 + 1, sq}});
        NQ.push({y + sc[e8][t - e8 + 1] + sc[sq + 1][t - sq], {e8, sq + 1}});
        NQ.push({y + sc[e8][t - e8 + 1] + sc[sq][t - sq + 1], {e8, sq}});
      }
    }
    while (!NQ.empty()) {
      auto x = NQ.front();
      NQ.pop();
      Q.push(x);
    }
    t++;
  }
  cout << dp[H + W - 2][H - 1][H - 1] << endl;
}
