#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int op(int a,int b){ return max(a,b); } int e(){ return 0; } int main(){ int H,W,N,P; cin>>H>>W>>N>>P; vector> x(N); rep(i,N){ cin>>x[i].first>>x[i].second; } sort(x.begin(),x.end()); segtree seg(300000); rep(i,N){ int y = x[i].second; seg.set(y,max(seg.get(y),seg.prod(0,y+1)+1)); } int V = seg.all_prod(); //cout<