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,W];
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                for(int k=0;k<H;k++){
                    for(int l=0;l<W;l++){
                        if(i == 0 && j == 0 && k == 0 && l == 0){
                            dp[i,j,k,l] = a[i,j];
                        }
                        else if(i == H-1 && j == W-1 && k == H-1 && l == W-1){
                            long max = dp[i-1,j,k-1,l];
                            if(max < dp[i-1,j,k,l-1]){
                                max = dp[i-1,j,k,l-1];
                            }
                            if(max < dp[i,j-1,k-1,l]){
                                max = dp[i,j-1,k-1,l];
                            }
                            if(max < dp[i,j-1,k,l-1]){
                                max = dp[i,j-1,k,l-1];
                            }
                            dp[i,j,k,l] = max + a[H-1,W-1];
                        }
                        else if((i == k && j == l) || (i+j != k+l)){
                            dp[i,j,k,l] = 0;
                        }
                        else{
                            long max = 0;
                            if(i != 0 && k != 0){
                                max = dp[i-1,j,k-1,l];
                            }
                            if(i != 0 && l != 0 && max < dp[i-1,j,k,l-1]){
                                max = dp[i-1,j,k,l-1];
                            }
                            if(j != 0 && k != 0 && max < dp[i,j-1,k-1,l]){
                                max = dp[i,j-1,k-1,l];
                            }
                            if(j != 0 && l != 0 && max < dp[i,j-1,k,l-1]){
                                max = dp[i,j-1,k,l-1];
                            }
                            dp[i,j,k,l] = max + a[i,j] + a[k,l];
                        }
                    }
                }
            }
        }
        sb.Append(dp[H-1,W-1,H-1,W-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]);
            }
        }
    }    
}