
		priority_queue<NODE> Q;
		Q.push(NODE(start,P(start.x-1,start.y),0));
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			//usleep(30000);
			if(memo[q.cost][q.cur.y][q.cur.x])continue;
			else memo[q.cost][q.cur.y][q.cur.x] = true;
			
			if(q.cur.x == goal.x && q.cur.y == goal.y){
				cout << q.cost << endl;
				break;
			}
			rep(i,4){
				int dir = i/2;
				P nextP = P(q.cur.x+dx[i],q.cur.y+dy[i]);
				int nextCost = q.cost + add[q.cur.y][q.cur.x][nextP.y][nextP.x] + d;
				if(
					nextCost > 100 || 
					!correct(nextP.x,nextP.y) || 
					binary_search(stop.begin(),stop.end(),make_pair(q.cur,nextP)) || 
					(nextP.x == q.prev.x && nextP.y == q.prev.y) || 
					(data[nextCost][nextP.y][nextP.x] != -1 && data[nextCost][nextP.y][nextP.x] == dir)
				){
					continue;
				}
				Q.push( NODE(nextP,q.cur,nextCost) );
			}
		}
	}
}