#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl; #define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } using namespace std; typedef long long ll; template vector> vec2d(int n, int m, T v){ return vector>(n, vector(m, v)); } template vector>> vec3d(int n, int m, int k, T v){ return vector>>(n, vector>(m, vector(k, v))); } template void print_vector(vector v, char delimiter=' '){ if(v.empty()) { cout << endl; return; } for(int i = 0; i+1 < v.size(); i++) cout << v[i] << delimiter; cout << v.back() << endl; } using mint = atcoder::modint998244353; ostream& operator<<(ostream& os, const mint& m){ os << m.val(); return os; } using P = pair; /** * verified(strict=true): https://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=6665054 */ template int longest_increasing_sequence(const vector &v, bool strict){ int n = v.size(); const T inf = (*max_element(v.begin(), v.end()))+1; vector dp(n, inf); for(int i = 0; i < n; i++){ if(strict){ auto p = lower_bound(dp.begin(), dp.end(), v[i]); int j = p-dp.begin(); dp[j] = v[i]; }else{ auto p = upper_bound(dp.begin(), dp.end(), v[i]); int j = p-dp.begin(); dp[j] = v[i]; } } for(int j = n-1; j >= 0; j--){ if(dp[j] != inf) return j+1; } assert(false); } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; int h, w, n, p; cin >> h >> w >> n >> p; vector

vp; for(int i = 0; i < n; i++){ int x, y; cin >> x >> y; vp.push_back(P(x, y)); } sort(vp.begin(), vp.end()); vector v; for(int i = 0; i < n; i++) v.push_back(vp[i].second); int lis = longest_increasing_sequence(v, false); mint q = 1-mint(p).inv(); mint q2 = 1-2*mint(p).inv(); mint ans = 1-q2.pow(lis)*q.pow(h+w-3-lis); cout << ans << endl; }