#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>h>>w; vector st(h); for(Int i=0;i>st[i]; const Int INF = 1e15; vector< vector > dp(h,vector(w,INF)); dp[0][0]=0; for(Int i=0;i