#include<iostream>
#include<queue>
using namespace std;
#define _for(i, a, b) for(int i = (a); i < (b); i ++ )
#define _rep(i, a, b) for(int i = (a); i <= (b); i ++ )
struct state
{
int x, y, hp, nut_hp, t;
state() {};
state(int a, int b, int c, int d, int e) : x(a), y(b), hp(c), nut_hp(d), t(e) {}
}in, out;
const int N = 210;
int g[N][N];
bool st[N][N][15][2];
int m, n, b, nt;
int bfs()
{
int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
queue<state> q;
q.push(in);
while(q.size())
{
state t = q.front();
q.pop();
if(st[t.x][t.y][t.hp][t.nut_hp]) continue;
st[t.x][t.y][t.hp][t.nut_hp] = 1;
if(t.x == out.x && t.y == out.y)
return t.t;
_for(i, 0, 4)
{
int x = t.x + dx[i], y = t.y + dy[i];
if(x > 0 && x <= m &&