#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a vector make_v(size_t a){return vector(a);} template auto make_v(size_t a,Ts... ts){ return vector(ts...))>(a,make_v(ts...)); } template typename enable_if::value!=0>::type fill_v(U &u,const V... v){u=U(v...);} template typename enable_if::value==0>::type fill_v(U &u,const V... v){ for(auto &e:u) fill_v(e,v...); } //INSERT ABOVE HERE signed main(){ int h,w; cin>>h>>w; auto a=make_v(h,w); for(int i=0;i>a[i][j]; const int INF = 1e9; int ans=INF,cnt=0; auto in=[&](int y,int x){ return 0<=y&&y dfs= [&](int y,int x)->void{ if(y==h){ for(int i=0;i=INF) cout<<"Impossible"<