#include using namespace std; #define int long long const int maxn = 255; int n,k; int cnt; bitset vis[maxn]; int gr[maxn][maxn]; class node{ public: int x,y,val; node(){} node(int _x,int _y,int _val):x(_x),y(_y),val(_val){} friend bool operator<(node a,node b){return a.val < b.val;} }; priority_queue pq; priority_queue fpq; int solve1(){ int localk = cnt; if(localk&1)return numeric_limits::min(); localk>>=1; int fans = 0; for(int i = 0;i<=n;++i)vis[i] = 0; while(localk){ localk -= 1; auto ed = fpq.top(); fpq.pop(); vis[ed.x][ed.y] = 1; fans += ed.val; } return fans+k; } int solve2(){ for(int i = 0;i<=n;++i)vis[i] = 0; int localk = cnt; int fans = 0; while(localk){ localk-=1; auto ed = pq.top(); pq.pop(); vis[ed.x][ed.y] = 1; fans += ed.val; } return fans; } signed main(){ cin >> n >> k; n *= 2; char ch; for(int i = 0;i> ch; if(ch == '#')cnt++; } for(int i = 1;i<=n;++i){ for(int j = 1;j<=n;++j){ cin >> gr[i][j]; pq.push(node(i,j,gr[i][j])); } } for(int i = 1;i<=n;++i){ for(int j = 1;j<=n>>1;++j){ fpq.push(node(i,j,gr[i][j] + gr[i][n+1-j])); } } cout << max(solve1(),solve2()); return 0; }