//abc+bcc=532
#include<bits/stdc++.h>
using namespace std;
#define st first
#define se second
#define int long long
typedef pair<int,pair<int,int>> piii;
int n,m,res;
const int N =1e3+100;
int dx[2] ={-1,1};
int dy[2]={-1,1};
int v[N][N];
int v1,v2;
queue<piii>...