using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    int H,W;
    int[,] a; 
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Read();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        long[,,] dp = new long[H,W,H];
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                for(int k=0;k<H;k++){
                    if(i == 0 && j == 0 && k == 0 &&){
                        dp[i,j,k] = a[i,j];
                    }
                    else if(i == H-1 && j == W-1 && k == H-1){
                        long max = dp[i-1,j,k-1];
                        if(max < dp[i-1,j,k]){
                            max = dp[i-1,j,k];
                        }
                        if(max < dp[i,j-1,k-1]){
                            max = dp[i,j-1,k-1];
                        }
                        if(max < dp[i,j-1,k]){
                            max = dp[i,j-1,k];
                        }
                        dp[i,j,k] = max + a[H-1,W-1];
                    }
                    else if(i == k){
                        dp[i,j,k] = 0;
                    }
                    else{
                        long max = 0;
                        if(i != 0 && k != 0){
                            max = dp[i-1,j,k-1];
                        }
                        if(i != 0 && k != (i+j) && max < dp[i-1,j,k]){
                            max = dp[i-1,j,k];
                        }
                        if(j != 0 && k != 0 && max < dp[i,j-1,k-1]){
                            max = dp[i,j-1,k-1];
                        }
                        if(j != 0 && k != (i+j) && max < dp[i,j-1,k]){
                            max = dp[i,j-1,k];
                        }
                        dp[i,j,k,l] = max + a[i,j] + a[k,i+j-k];
                    }
                }
            }
        }
        sb.Append(dp[H-1,W-1,H-1]+"\n");
    }
    void Read(){
        string[] str = Console.ReadLine().Split(' ');
        H = int.Parse(str[0]);
        W = int.Parse(str[1]);
        a = new int[H,W];
        for(int i=0;i<H;i++){
            str = Console.ReadLine().Split(' ');
            for(int j=0;j<W;j++){
                a[i,j] = int.Parse(str[j]);
            }
        }
    }    
}